Sha256: 0b13a3dc51c052f25a6eb8e19c382d9896a23204dc06c80de644721a4aad8534

Contents?: true

Size: 1.67 KB

Versions: 18

Compression:

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

Version data entries

18 entries across 18 versions & 6 rubygems

Version Path
dchelimsky-rspec-1.1.11.1 lib/spec/story/runner.rb
dchelimsky-rspec-1.1.11.2 lib/spec/story/runner.rb
dchelimsky-rspec-1.1.11.3 lib/spec/story/runner.rb
dchelimsky-rspec-1.1.11.4 lib/spec/story/runner.rb
dchelimsky-rspec-1.1.11.5 lib/spec/story/runner.rb
dchelimsky-rspec-1.1.11.6 lib/spec/story/runner.rb
dchelimsky-rspec-1.1.11.7 lib/spec/story/runner.rb
dchelimsky-rspec-stories-1.0.0 lib/spec/story/runner.rb
samstokes-rspec-stories-1.0.1 lib/spec/story/runner.rb
samstokes-rspec-stories-1.0.2 lib/spec/story/runner.rb
mack-0.8.3 lib/gems/rspec-1.1.12/lib/spec/story/runner.rb
mack-0.8.3.1 lib/gems/rspec-1.1.12/lib/spec/story/runner.rb
rspec-1.1.12 lib/spec/story/runner.rb
spree-0.6.0 vendor/plugins/rspec/lib/spec/story/runner.rb
spree-0.7.0 vendor/plugins/rspec/lib/spec/story/runner.rb
spree-0.7.1 vendor/plugins/rspec/lib/spec/story/runner.rb
spree-0.8.0 vendor/plugins/rspec/lib/spec/story/runner.rb
spree-0.8.1 vendor/plugins/rspec/lib/spec/story/runner.rb