Sha256: b8d5d44f6cff955454ede3f2d40c0225e5044a1329a9e0dcd22e600a7b086e00

Contents?: true

Size: 1.18 KB

Versions: 14

Compression:

Stored size: 1.18 KB

Contents

require 'mocha/options'
require 'mocha/deprecation'

module Mocha

  module Integration

    class << self

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

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

      def mini_test_testcase_defined?
        defined?(MiniTest::Unit::TestCase)
      end

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

    end

  end

end

unless Mocha::Integration.monkey_patches.any?
  Mocha::Deprecation.warning("Test::Unit or MiniTest must be loaded *before* Mocha.")
  Mocha::Deprecation.warning("If you're integrating with another test library, you should probably require 'mocha_standalone' instead of 'mocha'")
end

Mocha::Integration.monkey_patches.each do |patch|
  require patch
end

Version data entries

14 entries across 13 versions & 3 rubygems

Version Path
mocha-0.12.10 lib/mocha/integration.rb
mocha-0.12.9 lib/mocha/integration.rb
mocha-0.12.8 lib/mocha/integration.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration.rb
challah-0.8.3 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration.rb
mocha-0.12.7 lib/mocha/integration.rb
mocha-0.12.6 lib/mocha/integration.rb
mocha-0.12.5 lib/mocha/integration.rb
challah-0.8.1 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration.rb
mocha-0.12.4 lib/mocha/integration.rb
challah-rolls-0.1.0 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration.rb
mocha-0.12.3 lib/mocha/integration.rb
mocha-0.12.1 lib/mocha/integration.rb