diff options
author | James Mead <james@floehopper.org> | 2012-08-27 14:16:34 +0100 |
---|---|---|
committer | James Mead <james@floehopper.org> | 2012-11-13 08:25:14 +0000 |
commit | 5573c1d29565f17aca48b6a320a676bf9f962f20 (patch) | |
tree | ab08a8b7c0e46baf7b9f5f73d3e402d9d79863d1 /activesupport | |
parent | c3e186ec8dcb2ec26d5d56f3e89123b1350c4a6f (diff) | |
download | rails-5573c1d29565f17aca48b6a320a676bf9f962f20.tar.gz rails-5573c1d29565f17aca48b6a320a676bf9f962f20.tar.bz2 rails-5573c1d29565f17aca48b6a320a676bf9f962f20.zip |
Fix for Test::Unit Mocha compatibility.
Mocha is now using a single AssertionCounter which needs a reference to
the testcase as opposed to the result.
This change is an unfortunate consequence of the copying of a chunk of
Mocha's internal code in order to monkey-patch Test::Unit.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/testing/setup_and_teardown.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb index 0a78442f17..d21511d4db 100644 --- a/activesupport/lib/active_support/testing/setup_and_teardown.rb +++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb @@ -61,7 +61,7 @@ module ActiveSupport def run(result) return if @method_name.to_s == "default_test" - mocha_counter = retrieve_mocha_counter(result) + mocha_counter = retrieve_mocha_counter(self, result) yield(Test::Unit::TestCase::STARTED, name) @_result = result @@ -102,14 +102,16 @@ module ActiveSupport protected - def retrieve_mocha_counter(result) #:nodoc: + def retrieve_mocha_counter(test_case, result) #:nodoc: if respond_to?(:mocha_verify) # using mocha if defined?(Mocha::TestCaseAdapter::AssertionCounter) Mocha::TestCaseAdapter::AssertionCounter.new(result) elsif defined?(Mocha::Integration::TestUnit::AssertionCounter) Mocha::Integration::TestUnit::AssertionCounter.new(result) - else + elsif defined?(Mocha::MonkeyPatching::TestUnit::AssertionCounter) Mocha::MonkeyPatching::TestUnit::AssertionCounter.new(result) + else + Mocha::Integration::AssertionCounter.new(test_case) end end end |