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

### Methods

add_listener new run

### Public Class methods

new()

[Source]

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

### Public Instance methods

add_listener(listener)

[Source]

        # File lib/spec/story/runner/scenario_runner.rb, line 34
    34:         def add_listener(listener)
    35:           @listeners << listener
    36:         end

run(scenario, world)

[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:
    15:           unless scenario.body
    16:             @listeners.each { |l| l.scenario_pending(scenario.story.title, scenario.name, '') }
    17:             return true
    18:           end
    19:
    20:           world.instance_eval(&scenario.body)
    21:           if world.errors.empty?
    22:             @listeners.each { |l| l.scenario_succeeded(scenario.story.title, scenario.name) }
    23:           else
    24:             if Spec::Example::ExamplePendingError === (e = world.errors.first)
    25:               @listeners.each { |l| l.scenario_pending(scenario.story.title, scenario.name, e.message) }
    26:             else
    27:               @listeners.each { |l| l.scenario_failed(scenario.story.title, scenario.name, e) }
    28:               return false
    29:             end
    30:           end
    31:           true
    32:         end

[Validate]