Module: ActiveSupport::Testing::SetupAndTeardown::ForMiniTest

Defined in:
lib/active_support/testing/setup_and_teardown.rb

Constant Summary collapse

PASSTHROUGH_EXCEPTIONS =
MiniTest::Unit::TestCase::PASSTHROUGH_EXCEPTIONS rescue [NoMemoryError, SignalException, Interrupt, SystemExit]

Instance Method Summary collapse

Instance Method Details

#run(runner) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/active_support/testing/setup_and_teardown.rb', line 32

def run(runner)
  result = '.'
  begin
    run_callbacks :setup do
      result = super
    end
  rescue *PASSTHROUGH_EXCEPTIONS => e
    raise e
  rescue Exception => e
    result = runner.puke(self.class, method_name, e)
  ensure
    begin
      run_callbacks :teardown
    rescue *PASSTHROUGH_EXCEPTIONS => e
      raise e
    rescue Exception => e
      result = runner.puke(self.class, method_name, e)
    end
  end
  result
end