1 require 'spec/story/runner/scenario_collector.rb'
2 require 'spec/story/runner/scenario_runner.rb'
3 require 'spec/story/runner/story_runner.rb'
4 require 'spec/story/runner/story_parser.rb'
5 require 'spec/story/runner/story_mediator.rb'
6 require 'spec/story/runner/plain_text_story_runner.rb'
12 def run_options # :nodoc:
13 @run_options ||= ::Spec::Runner::OptionParser.parse(ARGV, $stderr, $stdout)
16 def story_runner # :nodoc:
18 @story_runner = StoryRunner.new(scenario_runner, world_creator)
19 run_options.story_formatters.each do |formatter|
20 register_listener(formatter)
22 Runner.register_exit_hook
27 def scenario_runner # :nodoc:
28 @scenario_runner ||= ScenarioRunner.new
31 def world_creator # :nodoc:
32 @world_creator ||= World
35 # Use this to register a customer output formatter.
36 def register_listener(listener)
37 story_runner.add_listener(listener) # run_started, story_started, story_ended, #run_ended
38 world_creator.add_listener(listener) # found_scenario, step_succeeded, step_failed, step_failed
39 scenario_runner.add_listener(listener) # scenario_started, scenario_succeeded, scenario_pending, scenario_failed
42 def register_exit_hook # :nodoc:
43 # TODO - when story runner uses test/unit runners like example runner does we can kill
44 # this and also the assorted Kernel.stub!(:at_exit) in examples
46 Runner.story_runner.run_stories unless $!
48 # TODO exit with non-zero status if run fails