Module: Mocha::Integration::Protest::Runner

Defined in:
lib/mocha-protest-integration.rb

Instance Method Summary collapse

Instance Method Details

#report(test, running_global_setup_or_teardown = false) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/mocha-protest-integration.rb', line 27

def report(test, running_global_setup_or_teardown=false)
  @report.on_test(::Protest::Test.new(test)) if @report.respond_to?(:on_test) && !running_global_setup_or_teardown
  test.run(@report)
  @report.on_pass(::Protest::PassedTest.new(test)) unless running_global_setup_or_teardown
rescue Mocha::ExpectationError => e                        # mocha
  @report.on_failure(::Protest::FailedTest.new(test, e))   # mocha
rescue ::Protest::Pending => e
  @report.on_pending(::Protest::PendingTest.new(test, e))
rescue ::Protest::AssertionFailed => e
  @report.on_failure(::Protest::FailedTest.new(test, e))
rescue ::Exception => e
  @report.on_error(::Protest::ErroredTest.new(test, e))
  raise if running_global_setup_or_teardown
end