Class Spec::Story::Runner::ScenarioRunner
In: vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb
Parent: Object

Methods

add_listener   new   run  

Public Class methods

[Source]

   # File vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb, line 5
5:         def initialize
6:           @listeners = []
7:         end

Public Instance methods

[Source]

    # File vendor/plugins/rspec/lib/spec/story/runner/scenario_runner.rb, line 26
26:         def add_listener(listener)
27:           @listeners << listener
28:         end

[Source]

    # File vendor/plugins/rspec/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:             end
23:           end
24:         end

[Validate]