test/unit/oauth_test.rb in xero_gateway-2.0.13 vs test/unit/oauth_test.rb in xero_gateway-2.0.14
- old
+ new
@@ -40,16 +40,20 @@
should "be able to create access token from request token and secret" do
xero = XeroGateway::OAuth.new('token', 'secret')
consumer = OAuth::Consumer.new('token', 'secret')
xero.stubs(:consumer).returns(consumer)
-
- access_token = mock('access token', :token => 'atoken', :secret => 'asecret')
+
+ access_token = mock('access token')
+ access_token.expects(:token).twice.returns('atoken')
+ access_token.expects(:secret).twice.returns('asecret')
+ access_token.stubs(:params).returns({})
+
request_token = mock('request token')
request_token.expects(:get_access_token).returns(access_token)
OAuth::RequestToken.expects(:new).with(consumer, 'rtoken', 'rsecret').returns(request_token)
-
+
xero.authorize_from_request('rtoken', 'rsecret')
assert xero.access_token.is_a? OAuth::AccessToken
assert_equal "atoken", xero.access_token.token
assert_equal "asecret", xero.access_token.secret
end
@@ -79,12 +83,17 @@
should "be able to create access token with oauth verifier" do
xero = XeroGateway::OAuth.new('token', 'secret')
consumer = OAuth::Consumer.new('token', 'secret')
xero.stubs(:consumer).returns(consumer)
- access_token = mock('access token', :token => 'atoken', :secret => 'asecret')
+ access_token = mock('access token')
+ access_token.expects(:token).twice.returns('atoken')
+ access_token.expects(:secret).twice.returns('asecret')
+ access_token.stubs(:params).returns({})
+
request_token = mock('request token')
request_token.expects(:get_access_token).with(:oauth_verifier => "verifier").returns(access_token)
+
OAuth::RequestToken.expects(:new).with(consumer, 'rtoken', 'rsecret').returns(request_token)
xero.authorize_from_request('rtoken', 'rsecret', :oauth_verifier => "verifier")
end
\ No newline at end of file