Module: KanoahRSpecFormatter::Example

Defined in:
lib/kanoah_rspec_formatter/rspec_steps.rb

Instance Method Summary collapse

Instance Method Details

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



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/kanoah_rspec_formatter/rspec_steps.rb', line 3

def step(_step, options = {}, &block)
  [:steps] = [] if [:steps].nil?
  begin
    yield block
    [:steps].push({ step_name: _step,index: [:step_index], status: 'Pass' })
  rescue Exception => e
    [:steps].push({ step_name: _step, index: [:step_index], status: 'Fail', comment: e })
    fail
  ensure
    [:step_index] += 1 if .has_key?(:step_index)
  end
end