Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #29 from alto/master

Running tests
  • Loading branch information...
commit 8c8be55802360cdf73f60de9cd3dbf653dc953da 2 parents 00943dd + 998147d
@tlconnor tlconnor authored
View
1  .gitignore
@@ -1 +1,2 @@
.bundle
+.rvmrc
View
1  Gemfile
@@ -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
8 Gemfile.lock
@@ -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
2  Rakefile
@@ -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
17 test/unit/oauth_test.rb
@@ -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")
Please sign in to comment.
Something went wrong with that request. Please try again.