lib/gurke/step.rb in gurke-3.0.0 vs lib/gurke/step.rb in gurke-3.1.0
- old
+ new
@@ -59,43 +59,44 @@
reporter.invoke :start_step, self, scenario
result = find_and_run_step runner, scenario, world
rescue Interrupt
scenario.abort!
- result = StepResult.new self, :aborted
+ result = StepResult.new self, scenario, :aborted
raise
rescue StepPending => e
scenario.pending! e
- result = StepResult.new self, :pending, e
+ result = StepResult.new self, scenario, :pending, e
rescue Exception => e # rubocop:disable RescueException
scenario.failed! e
- result = StepResult.new self, :failed, e
+ result = StepResult.new self, scenario, :failed, e
ensure
reporter.invoke :end_step, result, scenario
end
def find_and_run_step(runner, scenario, world)
runner.with_filtered_backtrace do
match = Steps.find_step self, world, type
if scenario.pending? || scenario.failed? || scenario.aborted?
- return StepResult.new self, :skipped
+ return StepResult.new self, scenario, :skipped
end
m = world.method match.method_name
world.send match.method_name, *(match.params + [self])[0...m.arity]
- StepResult.new self, :passed
+ StepResult.new self, scenario, :passed
end
end
#
class StepResult
- attr_reader :step, :exception, :state
+ attr_reader :step, :exception, :state, :scenario
- def initialize(step, state, err = nil)
+ def initialize(step, scenario, state, err = nil)
@step = step
@state = state
+ @scenario = scenario
@exception = err
end
Step.public_instance_methods(false).each do |mth|
class_eval <<-RUBY, __FILE__, __LINE__ + 1