Sha256: 5b207d1eca96816b630a8791346f5795a63cc1e259c11a94e76906d46f6a4e63

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

require 'mocha/api'

if !MiniTest::Unit::TestCase.ancestors.include?(Mocha::API)
  
  require 'mocha/integration/mini_test/exception_translation'
  require 'mocha/integration/mini_test/version_13'
  require 'mocha/integration/mini_test/version_140'
  require 'mocha/integration/mini_test/version_141'
  require 'mocha/integration/mini_test/version_142_and_above'
  
  module MiniTest
    class Unit
      class TestCase
        
        include Mocha::API
        
        alias_method :run_before_mocha, :run
        remove_method :run
        
        mini_test_version = begin
          MiniTest::Unit::VERSION
        rescue LoadError
          'unknown'
        end
        
        $stderr.puts "Detected MiniTest version: #{mini_test_version}" if $options['debug']
        
        if (mini_test_version >= '1.3.0') && (mini_test_version <= '1.3.1')
          include Mocha::Integration::MiniTest::Version13
        elsif (mini_test_version == '1.4.0')
          include Mocha::Integration::MiniTest::Version140
        elsif (mini_test_version == '1.4.1')
          include Mocha::Integration::MiniTest::Version141
        elsif (mini_test_version >= '1.4.2') && (mini_test_version <= '1.6.0')
          include Mocha::Integration::MiniTest::Version142AndAbove
        elsif (mini_test_version > '1.6.0')
          $stderr.puts "*** MiniTest integration has not been verified but patching anyway ***" if $options['debug']
          include Mocha::Integration::MiniTest::Version142AndAbove
        else
          $stderr.puts "*** No Mocha integration for MiniTest version ***" if $options['debug']
        end
        
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mocha-0.9.10 lib/mocha/integration/mini_test.rb
mocha-0.9.9 lib/mocha/integration/mini_test.rb