Module: Spec::Story::Runner

Defined in:
lib/gems/rspec-1.1.11/lib/spec/story/runner.rb,
lib/gems/rspec-1.1.11/lib/spec/story/runner/story_parser.rb,
lib/gems/rspec-1.1.11/lib/spec/story/runner/story_runner.rb,
lib/gems/rspec-1.1.11/lib/spec/story/runner/story_mediator.rb,
lib/gems/rspec-1.1.11/lib/spec/story/runner/scenario_runner.rb,
lib/gems/rspec-1.1.11/lib/spec/story/runner/scenario_collector.rb,
lib/gems/rspec-1.1.11/spec/spec/story/runner/story_parser_spec.rb,
lib/gems/rspec-1.1.11/spec/spec/story/runner/story_runner_spec.rb,
lib/gems/rspec-1.1.11/spec/spec/story/runner/story_mediator_spec.rb,
lib/gems/rspec-1.1.11/spec/spec/story/runner/scenario_runner_spec.rb,
lib/gems/rspec-1.1.11/lib/spec/story/runner/plain_text_story_runner.rb,
lib/gems/rspec-1.1.11/spec/spec/story/runner/scenario_collector_spec.rb,
lib/gems/rspec-1.1.11/spec/spec/story/runner/plain_text_story_runner_spec.rb

Defined Under Namespace

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

Class Method Summary collapse

Class Method Details

.create_story_runnerObject



35
36
37
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 35

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

.dry_runObject



52
53
54
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 52

def dry_run
  run_options.dry_run
end

.register_exit_hookObject

:nodoc:



46
47
48
49
50
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 46

def 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.



40
41
42
43
44
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 40

def 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:



12
13
14
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 12

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

.scenario_runnerObject

:nodoc:



27
28
29
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 27

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

.story_runnerObject

:nodoc:



16
17
18
19
20
21
22
23
24
25
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 16

def 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:



31
32
33
# File 'lib/gems/rspec-1.1.11/lib/spec/story/runner.rb', line 31

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