Permalink
Browse files

Merge pull request #29 from alto/master

Running tests
  • Loading branch information...
2 parents 00943dd + 998147d commit 8c8be55802360cdf73f60de9cd3dbf653dc953da @tlconnor tlconnor committed Feb 20, 2012
Showing with 21 additions and 8 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 Gemfile
  3. +5 −3 Gemfile.lock
  4. +1 −1 Rakefile
  5. +13 −4 test/unit/oauth_test.rb
View
@@ -1 +1,2 @@
.bundle
+.rvmrc
View
@@ -2,6 +2,7 @@ source "http://rubygems.org"
gem 'builder', '>= 2.1.2'
gem 'oauth', '>= 0.3.6'
+gem 'i18n'
gem 'activesupport'
group :test do
View
@@ -3,11 +3,12 @@ GEM
specs:
activesupport (3.0.0)
builder (2.1.2)
+ i18n (0.6.0)
libxml-ruby (1.1.4)
- mocha (0.9.8)
- rake
+ metaclass (0.0.1)
+ mocha (0.10.4)
+ metaclass (~> 0.0.1)
oauth (0.4.3)
- rake (0.8.7)
shoulda (2.11.3)
PLATFORMS
@@ -16,6 +17,7 @@ PLATFORMS
DEPENDENCIES
activesupport
builder (>= 2.1.2)
+ i18n
libxml-ruby
mocha
oauth (>= 0.3.6)
View
@@ -7,7 +7,7 @@ task :default => :test
desc 'Test the xero gateway.'
Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
+ t.libs << '.'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
View
@@ -42,12 +42,16 @@ class OAuthTest < Test::Unit::TestCase
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
@@ -81,9 +85,14 @@ class OAuthTest < Test::Unit::TestCase
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")

0 comments on commit 8c8be55

Please sign in to comment.