1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activeresource/test/abstract_unit.rb
Cheah Chu Yeow cf32baf915 Rescue from Timeout::Error in ActiveResource::Connection.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
2008-04-22 09:30:56 +12:00

22 lines
No EOL
615 B
Ruby

require 'test/unit'
$:.unshift "#{File.dirname(__FILE__)}/../lib"
require 'active_resource'
require 'active_resource/http_mock'
$:.unshift "#{File.dirname(__FILE__)}/../test"
require 'setter_trap'
ActiveResource::Base.logger = Logger.new("#{File.dirname(__FILE__)}/debug.log")
# Wrap tests that use Mocha and skip if unavailable.
def uses_mocha(test_name)
unless Object.const_defined?(:Mocha)
require 'mocha'
require 'stubba'
end
yield
rescue LoadError => load_error
raise unless load_error.message =~ /mocha/i
$stderr.puts "Skipping #{test_name} tests. `gem install mocha` and try again."
end