Methods
Public Class methods
[ show source ]
# File lib/spec/story/runner/scenario_runner.rb, line 5 5: def initialize 6: @listeners = [] 7: end
Public Instance methods
[ show source ]
# File lib/spec/story/runner/scenario_runner.rb, line 28
28: def add_listener(listener)
29: @listeners << listener
30: end
[ show source ]
# File lib/spec/story/runner/scenario_runner.rb, line 9
9: def run(scenario, world)
10: @listeners.each { |l| l.scenario_started(scenario.story.title, scenario.name) }
11: run_story_ignoring_scenarios(scenario.story, world)
12:
13: world.start_collecting_errors
14: world.instance_eval(&scenario.body)
15: if world.errors.empty?
16: @listeners.each { |l| l.scenario_succeeded(scenario.story.title, scenario.name) }
17: else
18: if Spec::Example::ExamplePendingError === (e = world.errors.first)
19: @listeners.each { |l| l.scenario_pending(scenario.story.title, scenario.name, e.message) }
20: else
21: @listeners.each { |l| l.scenario_failed(scenario.story.title, scenario.name, e) }
22: return false
23: end
24: end
25: true
26: end