Skip to content
Browse files

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.
  • Loading branch information...
1 parent c3e186e commit 5573c1d29565f17aca48b6a320a676bf9f962f20 @floehopper floehopper committed
Showing with 5 additions and 3 deletions.
  1. +5 −3 activesupport/lib/active_support/testing/setup_and_teardown.rb
8 activesupport/lib/active_support/testing/setup_and_teardown.rb
@@ -61,7 +61,7 @@ module ForClassicTestUnit
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 @@ def run(result)
- 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)
elsif defined?(Mocha::Integration::TestUnit::AssertionCounter)
- else
+ elsif defined?(Mocha::MonkeyPatching::TestUnit::AssertionCounter)
+ else

0 comments on commit 5573c1d

Please sign in to comment.
Something went wrong with that request. Please try again.