Method: ATMFormatter::Example#step

Defined in:
lib/atm_formatter/steps.rb

#step(step, _options = {}, &block) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/atm_formatter/steps.rb', line 3

def step(step, _options = {}, &block)
  [:steps] = [] if [:steps].nil?
  if RSpec.configuration.dry_run?
    [:steps].push(step_name: step, index: [:step_index])
  else
    begin
      yield block
      [:steps].push(step_name: step, index: [:step_index], status: 'Pass')
    rescue => e
      [:steps].push(step_name: step, index: [:step_index], status: 'Fail', comment: process_exception(e))
      raise
    end
  end
ensure [:step_index] += 1 if .key?(:step_index)
end