Sha256: 9231cc35956661918b7d3a97de60b40182bf92e532f64b6b15d944552e598daf

Contents?: true

Size: 1.21 KB

Versions: 58

Compression:

Stored size: 1.21 KB

Contents

require 'mocha/expectation_error'

module Mocha
  
  module TestCaseAdapter

    def self.included(base)
      base.class_eval do

        alias_method :run_before_mocha_test_case_adapter, :run

        def run(result)
          yield(Test::Unit::TestCase::STARTED, name)
          @_result = result
          begin
            mocha_setup
            begin
              setup
              __send__(@method_name)
              mocha_verify { add_assertion }
            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

58 entries across 58 versions & 6 rubygems

Version Path
greatseth-google-geo-2.0 vendor/mocha-0.4.0/lib/mocha/test_case_adapter.rb
greatseth-google-geo-2.1 vendor/mocha-0.4.0/lib/mocha/test_case_adapter.rb
greatseth-google-geo-2.2 vendor/mocha-0.4.0/lib/mocha/test_case_adapter.rb
redcar-dev-0.12.1dev-java lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-dev-0.12.0dev-java lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.11 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.11.0dev lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.10 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.9.2 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.9.1 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.9.0 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.8.1 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.8 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.7 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.6.1 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.6 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.6.1dev lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.5.1 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.5 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.5.6dev lib/openssl/mocha/lib/mocha/test_case_adapter.rb