Sha256: 905eaae31f8aa401beb1daa7984f1e67293befecc06f8c0f1d4b05db66cc8c65

Contents?: true

Size: 1.38 KB

Versions: 10

Compression:

Stored size: 1.38 KB

Contents

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

module Mocha

  module MonkeyPatching

    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

10 entries across 8 versions & 3 rubygems

Version Path
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-rolls-0.1.0 vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-0.8.0.pre vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-0.7.1 vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-0.7.0 vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-0.7.0.pre2 vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
challah-0.7.0.pre vendor/bundle/gems/mocha-0.12.2/lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb
mocha-0.12.2 lib/mocha/monkey_patching/test_unit/ruby_version_185_and_below.rb