Module: Turnip::RSpec::Execute

Defined in:
lib/turnip_formatter/ext/turnip/rspec.rb

Instance Method Summary collapse

Instance Method Details

#push_scenario_metadata(scenario) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/turnip_formatter/ext/turnip/rspec.rb', line 21

def (scenario)
  steps = scenario.steps
  example.[:turnip_formatter].tap do |turnip|
    steps.each do |step|
      turnip[:steps] << {
        name: step.description,
        extra_args: step.extra_args,
        keyword: step.keyword
      }
    end
    turnip[:tags] += scenario.tags if scenario.respond_to?(:tags)
  end
end

#run_step(feature_file, step, index) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/turnip_formatter/ext/turnip/rspec.rb', line 8

def run_step(feature_file, step, index)
  begin
    step(step)
  rescue Turnip::Pending
    example.[:line_number] = step.line
    pending("No such step(#{index}): '#{step}'")
  rescue StandardError => e
    example.[:line_number] = step.line
    e.backtrace.push "#{feature_file}:#{step.line}:in step:#{index} `#{step.description}'"
    raise e
  end
end