Sha256: 79f513016a722ad6a2202eacc252df497f1fad8eb46004238e6fae52dda8c45d

Contents?: true

Size: 1.34 KB

Versions: 37

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 $mocha_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

37 entries across 33 versions & 4 rubygems

Version Path
challah-1.0.0.beta vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.10 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.9.1.beta.3 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
devise_sociable-0.1.0 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.9 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.8 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.9.1.beta vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.9.0 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.8.3 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.7 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.6 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.5 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-0.8.1 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.4 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
challah-rolls-0.1.0 vendor/bundle/gems/mocha-0.12.3/lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.3 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.1 lib/mocha/integration/test_unit/gem_version_203_to_220.rb
mocha-0.12.0 lib/mocha/integration/test_unit/gem_version_203_to_220.rb