Module: Mocha::Integration

Defined in:
lib/mocha/integration.rb,
lib/mocha/integration/mini_test/version_13.rb,
lib/mocha/integration/mini_test/version_140.rb,
lib/mocha/integration/mini_test/version_141.rb,
lib/mocha/integration/test_unit/gem_version_200.rb,
lib/mocha/integration/mini_test/assertion_counter.rb,
lib/mocha/integration/test_unit/assertion_counter.rb,
lib/mocha/integration/mini_test/exception_translation.rb,
lib/mocha/integration/mini_test/version_142_and_above.rb,
lib/mocha/integration/test_unit/gem_version_201_to_202.rb,
lib/mocha/integration/test_unit/gem_version_203_to_207.rb,
lib/mocha/integration/test_unit/ruby_version_185_and_below.rb,
lib/mocha/integration/test_unit/ruby_version_186_and_above.rb

Defined Under Namespace

Modules: MiniTest, TestUnit

Class Method Summary collapse

Class Method Details

.mini_unit_testcase_defined?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/mocha/integration.rb', line 22

def mini_unit_testcase_defined?
  defined?(MiniTest) && defined?(MiniTest::Unit) && defined?(MiniTest::Unit::TestCase)
end

.monkey_patchesObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/mocha/integration.rb', line 7

def monkey_patches
  patches = []
  if test_unit_testcase_defined? && !test_unit_testcase_inherits_from_miniunit_testcase?
    patches << 'mocha/integration/test_unit'
  end
  if mini_unit_testcase_defined?
    patches << 'mocha/integration/mini_test'
  end
  patches
end

.test_unit_testcase_defined?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/mocha/integration.rb', line 18

def test_unit_testcase_defined?
  defined?(Test) && defined?(Test::Unit) && defined?(Test::Unit::TestCase)
end

.test_unit_testcase_inherits_from_miniunit_testcase?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/mocha/integration.rb', line 26

def test_unit_testcase_inherits_from_miniunit_testcase?
  test_unit_testcase_defined? && mini_unit_testcase_defined? && Test::Unit::TestCase.ancestors.include?(MiniTest::Unit::TestCase)
end