Sha256: 126420854e61b6ce2ec5d0d2c2e67d8c4c6048bb6799ed25502ce3c6dfc04fb3

Contents?: true

Size: 1.39 KB

Versions: 14

Compression:

Stored size: 1.39 KB

Contents

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

module Mocha
  
  module Integration
    
    module TestUnit
      
      module RubyVersion185AndBelow
        def self.included(mod)
          $stderr.puts "Monkey patching Test::Unit for Ruby <= v1.8.5" if $mocha_options['debug']
        end
        def run(result)
          assertion_counter = AssertionCounter.new(result)
          yield(Test::Unit::TestCase::STARTED, name)
          @_result = result
          begin
            begin
              setup
              __send__(@method_name)
              mocha_verify(assertion_counter)
            rescue Mocha::ExpectationError => e
              add_failure(e.message, e.backtrace)
            rescue Test::Unit::AssertionFailedError => e
              add_failure(e.message, e.backtrace)
            rescue StandardError, ScriptError
              add_error($!)
            ensure
              begin
                teardown
              rescue Test::Unit::AssertionFailedError => e
                add_failure(e.message, e.backtrace)
              rescue StandardError, ScriptError
                add_error($!)
              end
            end
          ensure
            mocha_teardown
          end
          result.add_run
          yield(Test::Unit::TestCase::FINISHED, name)
        end
      end
      
    end
    
  end
  
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
challah-1.0.0.beta vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.9.1.beta.3 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
devise_sociable-0.1.0 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.9.1.beta vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.9.0 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.6.2 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.6.1 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.6.0 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.5.4 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.5.3 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.5.2 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
challah-0.5.1 vendor/bundle/gems/mocha-0.10.5/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
mocha-0.10.5 lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
mocha-0.10.4 lib/mocha/integration/test_unit/ruby_version_185_and_below.rb