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
redcar-0.3.4.3 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.3.4.2 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.3.4.1 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.3.4 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
redcar-0.3.3 lib/openssl/mocha/lib/mocha/test_case_adapter.rb
google-geo-2.3 vendor/mocha-0.4.0/lib/mocha/test_case_adapter.rb
google-geo-2.1 vendor/mocha-0.4.0/lib/mocha/test_case_adapter.rb
google-geo-2.0 vendor/mocha-0.4.0/lib/mocha/test_case_adapter.rb
mocha-0.4.0 lib/mocha/test_case_adapter.rb
mocha-0.5.0 lib/mocha/test_case_adapter.rb
mocha-0.5.3 lib/mocha/test_case_adapter.rb
mocha-0.5.5 lib/mocha/test_case_adapter.rb
mocha-0.5.6 lib/mocha/test_case_adapter.rb
mocha-0.5.2 lib/mocha/test_case_adapter.rb
mocha-0.5.1 lib/mocha/test_case_adapter.rb
mocha-0.5.4 lib/mocha/test_case_adapter.rb
puppet-0.24.0 test/lib/mocha/test_case_adapter.rb
puppet-0.24.1 test/lib/mocha/test_case_adapter.rb