Method: TestStep#perform

Defined in:
lib/test_case/test_step.rb

#perform(update: false, &block) ⇒ Object

Public: Performs the test step.

block - Block that performs the step.

Returns nothing.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/test_case/test_step.rb', line 43

def perform(update: false, &block)
  @update = update
  begin
    before_run
    run(&block)
    pass unless status == TestStatus::PASSED
  rescue Exception => e
    if e.is_a?(TestException)
      raise if @raising
    elsif e.is_a?(Minitest::Assertion)
      set_status(TestStatus.new(@test_case, TestStatus::FAILED, exception: e))
      raise TestException.new if @raising
    else
      set_status(TestStatus.new(@test_case, TestStatus::ERROR, exception: e))
      raise TestException.new if @raising || e.is_a?(Interrupt)  # ALWAYS raise Interrupt
    end
  ensure
    after_run
  end
end