ruby on rails - Mocking chain of methods in rspec -
there chain of methods gets user object. trying mock following return user in factory girl
@current_user = authorizeapirequest.call(request.headers).result i can mock object until call method i'm stuck @ mocking result method
allow(authorizeapirequest).to receive(:call).and_return(:user)
i found need use receive_message_chain
so worked me.
allow(authorizeapirequest).to receive_message_chain(:call, :result).and_return(user)
Comments
Post a Comment