Sha256: e8c0a9b073474f9f6295ee6eeb7d5d009de9edbfdc818ab3c8c36805b6dc6f77

Contents?: true

Size: 1.77 KB

Versions: 15

Compression:

Stored size: 1.77 KB

Contents

require 'mocha/integration/mini_test/assertion_counter'
require 'mocha/expectation_error'

module Mocha

  module Integration

    module MiniTest

      module Version230To2101
        def self.included(mod)
          $stderr.puts "Monkey patching MiniTest >= v2.3.0 <= v2.10.1" if $mocha_options['debug']
        end
        def run runner
          trap 'INFO' do
            time = runner.start_time ? Time.now - runner.start_time : 0
            warn "%s#%s %.2fs" % [self.class, self.__name__, time]
            runner.status $stderr
          end if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL

          assertion_counter = AssertionCounter.new(self)
          result = ""
          begin
            begin
              @passed = nil
              self.setup
              self.run_setup_hooks
              self.__send__ self.__name__
              mocha_verify(assertion_counter)
              result = "." unless io?
              @passed = true
            rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
              raise
            rescue Exception => e
              @passed = false
              result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
            ensure
              begin
                self.run_teardown_hooks
                self.teardown
              rescue *::MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
                raise
              rescue Exception => e
                result = runner.puke self.class, self.__name__, Mocha::Integration::MiniTest.translate(e)
              end
              trap 'INFO', 'DEFAULT' if ::MiniTest::Unit::TestCase::SUPPORTS_INFO_SIGNAL
            end
          ensure
            mocha_teardown
          end
          result
        end
      end

    end

  end

end

Version data entries

15 entries across 14 versions & 3 rubygems

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