From 26a2dbffa2f937e39c799003986cab57f4f2c12f Mon Sep 17 00:00:00 2001 From: Matthias Hennemeyer Date: Wed, 28 Jan 2009 17:25:44 +0100 Subject: [PATCH] Added minitest_tu_shim compatibility. --- lib/mocha.rb | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/mocha.rb b/lib/mocha.rb index 2cc657e..550ec27 100644 --- a/lib/mocha.rb +++ b/lib/mocha.rb @@ -37,11 +37,22 @@ end require 'mocha/test_case_adapter' require 'test/unit/testcase' -module Test - module Unit - class TestCase - include Mocha::Standalone - include Mocha::TestCaseAdapter +# The following condition: +# (Test::Unit::TestCase.superclass.to_s == "MiniTest::Unit::TestCase") +# will be satisfied only if the +# minitest_tu_shim (test/unit wrapper for minitest) +# has been activated by doing 'sudo use_minitest yes'. +# In this case, the right adapter has already been +# included into the actual TestCase and the behavior +# should not be changed by including Mocha::TestCaseAdapter. +unless Test::Unit::TestCase.superclass.to_s == "MiniTest::Unit::TestCase" + module Test + module Unit + class TestCase + include Mocha::Standalone + include Mocha::TestCaseAdapter + end end end end + -- 1.6.0.2