aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-11-20 12:07:56 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2008-11-20 13:47:35 -0800
commitd8a555e1376ed509c9f81c42229c5e923153eeb3 (patch)
treea6a66e86b9399930e6bfaff3ee86dfbe2ed1a800 /activesupport/lib
parenta5156d9c2c3fe63f8b6a352199e51544ae28876a (diff)
downloadrails-d8a555e1376ed509c9f81c42229c5e923153eeb3.tar.gz
rails-d8a555e1376ed509c9f81c42229c5e923153eeb3.tar.bz2
rails-d8a555e1376ed509c9f81c42229c5e923153eeb3.zip
Mocha 0.9.0 compatibility for test setup/teardown callbacks
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/testing/setup_and_teardown.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb
index dee8d63585..595178fbd4 100644
--- a/activesupport/lib/active_support/testing/setup_and_teardown.rb
+++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb
@@ -86,20 +86,21 @@ module ActiveSupport
def run_with_callbacks_and_mocha(result)
return if @method_name.to_s == "default_test"
+ assertion_counter = Mocha::TestCaseAdapter::AssertionCounter.new(result)
yield(Test::Unit::TestCase::STARTED, name)
@_result = result
begin
- mocha_setup
begin
run_callbacks :setup
setup
__send__(@method_name)
- mocha_verify { add_assertion }
+ mocha_verify(assertion_counter)
rescue Mocha::ExpectationError => e
add_failure(e.message, e.backtrace)
rescue Test::Unit::AssertionFailedError => e
add_failure(e.message, e.backtrace)
- rescue StandardError, ScriptError
+ rescue Exception
+ raise if Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS.include? $!.class
add_error($!)
ensure
begin
@@ -107,7 +108,8 @@ module ActiveSupport
run_callbacks :teardown, :enumerator => :reverse_each
rescue Test::Unit::AssertionFailedError => e
add_failure(e.message, e.backtrace)
- rescue StandardError, ScriptError
+ rescue Exception
+ raise if Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS.include? $!.class
add_error($!)
end
end