2013-03-27 59 views
0
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 

我怎樣才能嘲笑所有這些使用摩卡在鐵軌(主要是消費者)?如何在軌中初始化器中模擬變量?

回答

1
oauth_mock = mock('oauth') 
OAuth::Consumer.stubs(:new).returns(oauth_mock)