Sha256: 9abab7dc3ca496a5268e404252cec526468c12c511c4f513633a500e65b3f861

Contents?: true

Size: 1.33 KB

Versions: 26

Compression:

Stored size: 1.33 KB

Contents

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

module Mocha
  
  module Integration
    
    module TestUnit
      
      module GemVersion201To202
        def self.included(mod)
          $stderr.puts "Monkey patching Test::Unit gem >= v2.0.1 and <= v2.0.2" 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
          end
        end
      end
      
    end
    
  end
  
end

Version data entries

26 entries across 26 versions & 4 rubygems

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