Sha256: f5b1704a7ae0bbbd15530353d1bc78fa603f1fe99530fe444759f8c1672810ad

Contents?: true

Size: 1.75 KB

Versions: 17

Compression:

Stored size: 1.75 KB

Contents

require 'spec/story/runner/scenario_collector.rb'
require 'spec/story/runner/scenario_runner.rb'
require 'spec/story/runner/story_runner.rb'
require 'spec/story/runner/story_parser.rb'
require 'spec/story/runner/story_mediator.rb'
require 'spec/story/runner/plain_text_story_runner.rb'

module Spec
  module Story
    module Runner
      class << self
        def run_options # :nodoc:
          Spec::Runner.options
        end
        
        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
        
        def scenario_runner # :nodoc:
          @scenario_runner ||= ScenarioRunner.new
        end
        
        def world_creator # :nodoc:
          @world_creator ||= World
        end
        
        def create_story_runner
          Runner::StoryRunner.new(scenario_runner, world_creator)
        end
        
        # Use this to register a customer output formatter.
        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
        
        def register_exit_hook # :nodoc:
          at_exit do
            exit Runner.story_runner.run_stories unless $!
          end
        end
        
        def dry_run
          run_options.dry_run
        end
        
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 5 rubygems

Version Path
dchelimsky-rspec-1.1.10 lib/spec/story/runner.rb
dchelimsky-rspec-1.1.11 lib/spec/story/runner.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/lib/spec/story/runner.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/lib/spec/story/runner.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/lib/spec/story/runner.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/lib/spec/story/runner.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/lib/spec/story/runner.rb
merb-core-1.1.0.pre spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/lib/spec/story/runner.rb
mack-0.8.2 lib/gems/rspec-1.1.11/lib/spec/story/runner.rb
rspec-1.1.10 lib/spec/story/runner.rb
rspec-1.1.6 lib/spec/story/runner.rb
rspec-1.1.11 lib/spec/story/runner.rb
rspec-1.1.7 lib/spec/story/runner.rb
rspec-1.1.9 lib/spec/story/runner.rb
rspec-1.1.8 lib/spec/story/runner.rb
typo-5.1.98 vendor/plugins/rspec/lib/spec/story/runner.rb
typo-5.2 vendor/plugins/rspec/lib/spec/story/runner.rb