From 716bdfc01d45a61d211dbd766f494cb984fc9f9c Mon Sep 17 00:00:00 2001 From: James Mead Date: Sun, 26 Aug 2012 16:32:47 +0100 Subject: Copy Mocha bug fix. A bug was fixed [1] in Mocha's integration with Test::Unit, but this monkey-patching code was copied before the fix. We need to copy the fixed version. The bug meant that an unexpected invocation against a mock within the teardown method caused a test *error* and not a test *failure*. [1] https://github.com/freerange/mocha/commit/f1ff6475ca2871f2977ab84cabbbfe2adadbbee6#diff-5 --- activesupport/lib/active_support/testing/setup_and_teardown.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb index f2268d1767..0a78442f17 100644 --- a/activesupport/lib/active_support/testing/setup_and_teardown.rb +++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb @@ -83,6 +83,8 @@ module ActiveSupport begin teardown run_callbacks :teardown + rescue Mocha::ExpectationError => e + add_failure(e.message, e.backtrace) rescue Test::Unit::AssertionFailedError => e add_failure(e.message, e.backtrace) rescue Exception => e -- cgit v1.2.3