Sha256: a181e014302ffb5e13c842d863cd9aa1a7d6b1d92b7ae9ee75472a4c0dd15197

Contents?: true

Size: 1.34 KB

Versions: 20

Compression:

Stored size: 1.34 KB

Contents

require 'test/unit/testcase'
require 'mocha/integration/test_unit/assertion_counter'
require 'mocha/expectation_error'

module Mocha

  module Integration

    module TestUnit

      module GemVersion203To220
        def self.included(mod)
          $stderr.puts "Monkey patching Test::Unit gem >= v2.0.3 and <= v2.2.0" if $options['debug']
        end
        def run(result)
          assertion_counter = AssertionCounter.new(result)
          begin
            @_result = result
            yield(Test::Unit::TestCase::STARTED, name)
            begin
              begin
                run_setup
                run_test
                mocha_verify(assertion_counter)
              rescue Mocha::ExpectationError => e
                add_failure(e.message, e.backtrace)
              rescue Exception
                @interrupted = true
                raise unless handle_exception($!)
              ensure
                begin
                  run_teardown
                rescue Exception
                  raise unless handle_exception($!)
                end
              end
            ensure
              mocha_teardown
            end
            result.add_run
            yield(Test::Unit::TestCase::FINISHED, name)
          ensure
            # @_result = nil # For test-spec's after_all :<
          end
        end
      end

    end

  end

end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
challah-0.6.1 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.6.0 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.5.4 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.5.3 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.5.2 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.5.0 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.4.1 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.4.0 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.3.5 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.3.4 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.3.3 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.3.2 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.3.1 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.3.0 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.2.1 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.2.0 vendor/bundle/gems/mocha-0.10.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.10.3 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.10.2 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.10.1 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.10.0 lib/mocha/integration/test_unit/gem_version_203_to_220.rb