aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/test
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-02-03 18:25:37 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2009-02-03 18:40:22 -0800
commit278186534c0ccf285a20497461f40d2e54aa20a0 (patch)
treeeb39e80e8e02fa6f7e04d7803efc1fccda63d3a4 /activeresource/test
parent34a37ea9e8265972a93f0c4f62e44308c27751dd (diff)
downloadrails-278186534c0ccf285a20497461f40d2e54aa20a0.tar.gz
rails-278186534c0ccf285a20497461f40d2e54aa20a0.tar.bz2
rails-278186534c0ccf285a20497461f40d2e54aa20a0.zip
Bump mocha requirement for Ruby 1.9 compat. Remove uses_mocha.
Diffstat (limited to 'activeresource/test')
-rw-r--r--activeresource/test/abstract_unit.rb10
-rw-r--r--activeresource/test/connection_test.rb28
2 files changed, 16 insertions, 22 deletions
diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb
index e612412033..667a7b2a37 100644
--- a/activeresource/test/abstract_unit.rb
+++ b/activeresource/test/abstract_unit.rb
@@ -1,5 +1,8 @@
require 'test/unit'
+gem 'mocha', '>= 0.9.5'
+require 'mocha'
+
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
require 'active_resource/http_mock'
@@ -17,10 +20,3 @@ def uses_gem(gem_name, test_name, version = '> 0')
rescue LoadError
$stderr.puts "Skipping #{test_name} tests. `gem install #{gem_name}` and try again."
end
-
-# Wrap tests that use Mocha and skip if unavailable.
-unless defined? uses_mocha
- def uses_mocha(test_name, &block)
- uses_gem('mocha', test_name, '>= 0.5.5', &block)
- end
-end
diff --git a/activeresource/test/connection_test.rb b/activeresource/test/connection_test.rb
index 84bcf69219..831fbc4003 100644
--- a/activeresource/test/connection_test.rb
+++ b/activeresource/test/connection_test.rb
@@ -168,21 +168,19 @@ class ConnectionTest < Test::Unit::TestCase
assert_equal 200, response.code
end
- uses_mocha('test_timeout, test_accept_http_header') do
- def test_timeout
- @http = mock('new Net::HTTP')
- @conn.expects(:http).returns(@http)
- @http.expects(:get).raises(Timeout::Error, 'execution expired')
- assert_raise(ActiveResource::TimeoutError) { @conn.get('/people_timeout.xml') }
- end
-
- def test_accept_http_header
- @http = mock('new Net::HTTP')
- @conn.expects(:http).returns(@http)
- path = '/people/1.xml'
- @http.expects(:get).with(path, {'Accept' => 'application/xhtml+xml'}).returns(ActiveResource::Response.new(@matz, 200, {'Content-Type' => 'text/xhtml'}))
- assert_nothing_raised(Mocha::ExpectationError) { @conn.get(path, {'Accept' => 'application/xhtml+xml'}) }
- end
+ def test_timeout
+ @http = mock('new Net::HTTP')
+ @conn.expects(:http).returns(@http)
+ @http.expects(:get).raises(Timeout::Error, 'execution expired')
+ assert_raise(ActiveResource::TimeoutError) { @conn.get('/people_timeout.xml') }
+ end
+
+ def test_accept_http_header
+ @http = mock('new Net::HTTP')
+ @conn.expects(:http).returns(@http)
+ path = '/people/1.xml'
+ @http.expects(:get).with(path, {'Accept' => 'application/xhtml+xml'}).returns(ActiveResource::Response.new(@matz, 200, {'Content-Type' => 'text/xhtml'}))
+ assert_nothing_raised(Mocha::ExpectationError) { @conn.get(path, {'Accept' => 'application/xhtml+xml'}) }
end
protected