Displaying 1 result from an estimated 1 matches for "fake_token".
Did you mean:
make_token
2013 Jan 29
0
How to stub a class inside a module with Mocha in Ruby?
...sh)
end
get ''/login'' do
token = @twitterClient.request_token(callback)
# do some other checking
end
And here''s my test
it "should login with Twitter and save session" do
TwitterOAuth::Client.any_instance.stubs(:request_token).with(callback).returns(fake_token)
#it''s still going to the real twitter api.
end
I''ve read from somewhere that ruby mixin can be overridden in anywhere.
Clearly, I''m misunderstanding something.
The alternative way is I could wrap the gem again with class and then
stub from the class. Is that a go...