Class Client
def initialize(options = {})
@key = options['oauth_key']
@secret = options['oauth_secret']
@access_token_url = options['oauth_access_token_url']
@signature_method = options['signature_method']
@consumer = OAuth::Consumer.new(@key, @secret, {access_token_url: @access_token_url, signature_method: @signature_method})
end
How can i mock all these using mocha in rails(mainly the consumer) ?
oauth_mock = mock('oauth')
OAuth::Consumer.stubs(:new).returns(oauth_mock)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.