Module: Spec::Story::Runner

Defined in:
lib/spec/story/runner.rb,
lib/spec/story/runner/story_parser.rb,
lib/spec/story/runner/story_runner.rb,
lib/spec/story/runner/story_mediator.rb,
lib/spec/story/runner/scenario_runner.rb,
lib/spec/story/runner/scenario_collector.rb,
lib/spec/story/runner/plain_text_story_runner.rb

Defined Under Namespace

Classes: IllegalStepError, PlainTextStoryRunner, ScenarioCollector, ScenarioRunner, StoryMediator, StoryParser, StoryRunner

Class Method Summary collapse

Class Method Details

.create_story_runnerObject



34
35
36
# File 'lib/spec/story/runner.rb', line 34

def self.create_story_runner
  Runner::StoryRunner.new(scenario_runner, world_creator)
end

.dry_runObject



51
52
53
# File 'lib/spec/story/runner.rb', line 51

def self.dry_run
  run_options.dry_run
end

.register_exit_hookObject

:nodoc:



45
46
47
48
49
# File 'lib/spec/story/runner.rb', line 45

def self.register_exit_hook # :nodoc:
  at_exit do
    exit Runner.story_runner.run_stories unless $!
  end
end

.register_listener(listener) ⇒ Object

Use this to register a customer output formatter.



39
40
41
42
43
# File 'lib/spec/story/runner.rb', line 39

def self.register_listener(listener)
  story_runner.add_listener(listener) # run_started, story_started, story_ended, #run_ended
  world_creator.add_listener(listener) # found_scenario, step_succeeded, step_failed, step_failed
  scenario_runner.add_listener(listener) # scenario_started, scenario_succeeded, scenario_pending, scenario_failed
end

.run_optionsObject

:nodoc:



11
12
13
# File 'lib/spec/story/runner.rb', line 11

def self.run_options # :nodoc:
  Spec::Runner.options
end

.scenario_runnerObject

:nodoc:



26
27
28
# File 'lib/spec/story/runner.rb', line 26

def self.scenario_runner # :nodoc:
  @scenario_runner ||= ScenarioRunner.new
end

.story_runnerObject

:nodoc:



15
16
17
18
19
20
21
22
23
24
# File 'lib/spec/story/runner.rb', line 15

def self.story_runner # :nodoc:
  unless @story_runner
    @story_runner = create_story_runner
    run_options.story_formatters.each do |formatter|
      register_listener(formatter)
    end
    self.register_exit_hook
  end
  @story_runner
end

.world_creatorObject

:nodoc:



30
31
32
# File 'lib/spec/story/runner.rb', line 30

def self.world_creator # :nodoc:
  @world_creator ||= World
end