| |   |
| 10 | 10 | module Runner |
| 11 | 11 | class << self |
| 12 | 12 | def run_options # :nodoc: |
| 13 | | @run_options ||= ::Spec::Runner::OptionParser.parse(ARGV, $stderr, $stdout) |
| 13 | rspec_options |
| 14 | # @run_options ||= ::Spec::Runner::OptionParser.parse(ARGV, $stderr, $stdout) |
| 14 | 15 | end |
| 15 | 16 | |
| 16 | 17 | def story_runner # :nodoc: |
| 17 | 18 | unless @story_runner |
| 18 | | @story_runner = StoryRunner.new(scenario_runner, world_creator) |
| 19 | @story_runner = create_story_runner |
| 19 | 20 | run_options.story_formatters.each do |formatter| |
| 20 | 21 | register_listener(formatter) |
| 21 | 22 | end |
| 22 | | Runner.register_exit_hook |
| 23 | self.register_exit_hook |
| 23 | 24 | end |
| 24 | 25 | @story_runner |
| 25 | 26 | end |
| … | … | |
| 33 | 33 | @world_creator ||= World |
| 34 | 34 | end |
| 35 | 35 | |
| 36 | def create_story_runner |
| 37 | StoryRunner.new(scenario_runner, world_creator) |
| 38 | end |
| 39 | |
| 36 | 40 | # Use this to register a customer output formatter. |
| 37 | 41 | def register_listener(listener) |
| 38 | 42 | story_runner.add_listener(listener) # run_started, story_started, story_ended, #run_ended |
| … | … | |
| 45 | 45 | end |
| 46 | 46 | |
| 47 | 47 | def register_exit_hook # :nodoc: |
| 48 | puts caller(0)[1] |
| 48 | 49 | at_exit do |
| 49 | 50 | exit Runner.story_runner.run_stories unless $! |
| 50 | 51 | end |
| 51 | | |
| 52 | 52 | end |
| 53 | 53 | |
| 54 | 54 | def dry_run |
| toggle raw diff |
--- a/rspec/lib/spec/story/runner.rb
+++ b/rspec/lib/spec/story/runner.rb
@@ -10,16 +10,17 @@ module Spec
module Runner
class << self
def run_options # :nodoc:
- @run_options ||= ::Spec::Runner::OptionParser.parse(ARGV, $stderr, $stdout)
+ rspec_options
+ # @run_options ||= ::Spec::Runner::OptionParser.parse(ARGV, $stderr, $stdout)
end
def story_runner # :nodoc:
unless @story_runner
- @story_runner = StoryRunner.new(scenario_runner, world_creator)
+ @story_runner = create_story_runner
run_options.story_formatters.each do |formatter|
register_listener(formatter)
end
- Runner.register_exit_hook
+ self.register_exit_hook
end
@story_runner
end
@@ -32,6 +33,10 @@ module Spec
@world_creator ||= World
end
+ def create_story_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
@@ -40,10 +45,10 @@ module Spec
end
def register_exit_hook # :nodoc:
+ puts caller(0)[1]
at_exit do
exit Runner.story_runner.run_stories unless $!
end
-
end
def dry_run |
| |   |
| 22 | 22 | |
| 23 | 23 | it "should parse a story file" do |
| 24 | 24 | runner = PlainTextStoryRunner.new("path") |
| 25 | | |
| 26 | 25 | during { |
| 27 | | runner.run |
| 26 | runner.run(mock('runner')) |
| 28 | 27 | }.expect { |
| 29 | 28 | @parser.should_receive(:parse).with(["this", "and that"]) |
| 30 | 29 | } |
| 31 | 30 | end |
| 32 | 31 | |
| 33 | 32 | it "should build up a mediator with its own steps and the singleton story_runner" do |
| 33 | @story_runner = mock('story runner', :null_object => true) |
| 34 | |
| 34 | 35 | runner = PlainTextStoryRunner.new("path") |
| 35 | | Spec::Story::Runner.should_receive(:story_runner).and_return(story_runner = mock("story runner")) |
| 36 | | Spec::Story::Runner::StoryMediator.should_receive(:new).with(runner.steps, story_runner, {}). |
| 37 | | and_return(mediator = stub("mediator", :run_stories => nil)) |
| 38 | | runner.run |
| 36 | |
| 37 | Spec::Story::Runner::StoryMediator.should_receive(:new).with( |
| 38 | runner.steps, @story_runner, {} |
| 39 | ).and_return(mediator = stub("mediator", :run_stories => nil)) |
| 40 | runner.run(@story_runner) |
| 39 | 41 | end |
| 40 | 42 | |
| 41 | 43 | it "should build up a parser with the mediator" do |
| 42 | 44 | runner = PlainTextStoryRunner.new("path") |
| 43 | | Spec::Story::Runner.should_receive(:story_runner).and_return(story_runner = mock("story runner")) |
| 44 | 45 | Spec::Story::Runner::StoryMediator.should_receive(:new).and_return(mediator = stub("mediator", :run_stories => nil)) |
| 45 | 46 | Spec::Story::Runner::StoryParser.should_receive(:new).with(mediator).and_return(@parser) |
| 46 | | runner.run |
| 47 | runner.run(stub("story_runner")) |
| 47 | 48 | end |
| 48 | 49 | |
| 49 | 50 | it "should tell the mediator to run the stories" do |
| … | … | |
| 52 | 52 | mediator = mock("mediator") |
| 53 | 53 | Spec::Story::Runner::StoryMediator.should_receive(:new).and_return(mediator) |
| 54 | 54 | mediator.should_receive(:run_stories) |
| 55 | | runner.run |
| 55 | runner.run(mock('runner')) |
| 56 | 56 | end |
| 57 | 57 | |
| 58 | 58 | it "should accept a block instead of a path" do |
| … | … | |
| 60 | 60 | runner.load("path/to/story") |
| 61 | 61 | end |
| 62 | 62 | File.should_receive(:read).with("path/to/story").and_return("this\nand that") |
| 63 | | runner.run |
| 63 | runner.run(mock('runner')) |
| 64 | 64 | end |
| 65 | 65 | |
| 66 | 66 | it "should tell you if you try to run with no path set" do |
| 67 | 67 | runner = PlainTextStoryRunner.new |
| 68 | 68 | lambda { |
| 69 | | runner.run |
| 69 | runner.run(mock('runner')) |
| 70 | 70 | }.should raise_error(RuntimeError, "You must set a path to the file with the story. See the RDoc.") |
| 71 | 71 | end |
| 72 | 72 | |
| … | … | |
| 75 | 75 | Spec::Story::Runner::StoryMediator.should_receive(:new). |
| 76 | 76 | with(anything, anything, :foo => :bar). |
| 77 | 77 | and_return(mediator = stub("mediator", :run_stories => nil)) |
| 78 | | runner.run |
| 78 | runner.run(mock('runner')) |
| 79 | 79 | end |
| 80 | 80 | |
| 81 | 81 | it "should provide access to its options" do |
| … | … | |
| 84 | 84 | Spec::Story::Runner::StoryMediator.should_receive(:new). |
| 85 | 85 | with(anything, anything, :foo => :bar). |
| 86 | 86 | and_return(mediator = stub("mediator", :run_stories => nil)) |
| 87 | | runner.run |
| 87 | runner.run mock('runner') |
| 88 | 88 | end |
| 89 | 89 | |
| 90 | 90 | end |
| toggle raw diff |
--- a/rspec/spec/spec/story/runner/plain_text_story_runner_spec.rb
+++ b/rspec/spec/spec/story/runner/plain_text_story_runner_spec.rb
@@ -22,28 +22,29 @@ module Spec
it "should parse a story file" do
runner = PlainTextStoryRunner.new("path")
-
during {
- runner.run
+ runner.run(mock('runner'))
}.expect {
@parser.should_receive(:parse).with(["this", "and that"])
}
end
it "should build up a mediator with its own steps and the singleton story_runner" do
+ @story_runner = mock('story runner', :null_object => true)
+
runner = PlainTextStoryRunner.new("path")
- Spec::Story::Runner.should_receive(:story_runner).and_return(story_runner = mock("story runner"))
- Spec::Story::Runner::StoryMediator.should_receive(:new).with(runner.steps, story_runner, {}).
- and_return(mediator = stub("mediator", :run_stories => nil))
- runner.run
+
+ Spec::Story::Runner::StoryMediator.should_receive(:new).with(
+ runner.steps, @story_runner, {}
+ ).and_return(mediator = stub("mediator", :run_stories => nil))
+ runner.run(@story_runner)
end
it "should build up a parser with the mediator" do
runner = PlainTextStoryRunner.new("path")
- Spec::Story::Runner.should_receive(:story_runner).and_return(story_runner = mock("story runner"))
Spec::Story::Runner::StoryMediator.should_receive(:new).and_return(mediator = stub("mediator", :run_stories => nil))
Spec::Story::Runner::StoryParser.should_receive(:new).with(mediator).and_return(@parser)
- runner.run
+ runner.run(stub("story_runner"))
end
it "should tell the mediator to run the stories" do
@@ -51,7 +52,7 @@ module Spec
mediator = mock("mediator")
Spec::Story::Runner::StoryMediator.should_receive(:new).and_return(mediator)
mediator.should_receive(:run_stories)
- runner.run
+ runner.run(mock('runner'))
end
it "should accept a block instead of a path" do
@@ -59,13 +60,13 @@ module Spec
runner.load("path/to/story")
end
File.should_receive(:read).with("path/to/story").and_return("this\nand that")
- runner.run
+ runner.run(mock('runner'))
end
it "should tell you if you try to run with no path set" do
runner = PlainTextStoryRunner.new
lambda {
- runner.run
+ runner.run(mock('runner'))
}.should raise_error(RuntimeError, "You must set a path to the file with the story. See the RDoc.")
end
@@ -74,7 +75,7 @@ module Spec
Spec::Story::Runner::StoryMediator.should_receive(:new).
with(anything, anything, :foo => :bar).
and_return(mediator = stub("mediator", :run_stories => nil))
- runner.run
+ runner.run(mock('runner'))
end
it "should provide access to its options" do
@@ -83,7 +84,7 @@ module Spec
Spec::Story::Runner::StoryMediator.should_receive(:new).
with(anything, anything, :foo => :bar).
and_return(mediator = stub("mediator", :run_stories => nil))
- runner.run
+ runner.run mock('runner')
end
end |
| |   |
| 1 | 1 | require File.dirname(__FILE__) + '/story_helper' |
| 2 | require 'spec/runner/formatter/story/plain_text_formatter' |
| 3 | require 'spec/runner/formatter/story/html_formatter' |
| 2 | 4 | |
| 3 | 5 | module Spec |
| 4 | 6 | module Story |
| 5 | 7 | describe Runner, "module" do |
| 6 | | def dev_null |
| 7 | | io = StringIO.new |
| 8 | | def io.write(str) |
| 9 | | str.to_s.size |
| 10 | | end |
| 11 | | return io |
| 12 | | end |
| 13 | | |
| 14 | | before :each do |
| 15 | | Kernel.stub!(:at_exit) |
| 16 | | @stdout, $stdout = $stdout, dev_null |
| 17 | | @argv = Array.new(ARGV) |
| 18 | | @runner_module = Runner.dup |
| 8 | before(:each) do |
| 19 | 9 | @world_creator = World.dup |
| 20 | | @runner_module.module_eval { @run_options = @story_runner = @scenario_runner = @world_creator = nil } |
| 10 | @runner_module = Runner.dup |
| 11 | @runner_module.instance_eval {@story_runner = nil} |
| 12 | @runner_module.stub!(:register_exit_hook) |
| 21 | 13 | end |
| 22 | 14 | |
| 23 | | after :each do |
| 24 | | $stdout = @stdout |
| 25 | | ARGV.replace @argv |
| 26 | | @runner_module.module_eval { @run_options = @story_runner = @scenario_runner = @world_creator = nil } |
| 15 | def create_options(args=[]) |
| 16 | Spec::Runner::OptionParser.parse(args, StringIO.new, StringIO.new) |
| 27 | 17 | end |
| 28 | 18 | |
| 29 | 19 | it 'should wire up a singleton StoryRunner' do |
| … | … | |
| 22 | 22 | |
| 23 | 23 | it 'should set its options based on ARGV' do |
| 24 | 24 | # given |
| 25 | | ARGV << '--dry-run' |
| 26 | | |
| 25 | @runner_module.should_receive(:run_options).and_return( |
| 26 | create_options(['--dry-run']) |
| 27 | ) |
| 28 | |
| 27 | 29 | # when |
| 28 | 30 | options = @runner_module.run_options |
| 29 | 31 | |
| 30 | 32 | # then |
| 31 | 33 | options.dry_run.should be_true |
| 32 | 34 | end |
| 33 | | |
| 34 | | it 'should add a reporter to the runner classes' do |
| 35 | | # given |
| 36 | | story_runner = mock('story runner', :null_object => true) |
| 37 | | scenario_runner = mock('scenario runner', :null_object => true) |
| 38 | | world_creator = mock('world', :null_object => true) |
| 39 | | |
| 40 | | @runner_module::class_eval { @world_creator = world_creator } |
| 41 | | @runner_module::StoryRunner.stub!(:new).and_return(story_runner) |
| 42 | | @runner_module::ScenarioRunner.stub!(:new).and_return(scenario_runner) |
| 43 | | |
| 44 | | # expect |
| 45 | | world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter)) |
| 46 | | story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter)) |
| 47 | | scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter)) |
| 48 | | |
| 49 | | # when |
| 50 | | @runner_module.story_runner |
| 51 | | end |
| 52 | 35 | |
| 53 | | it 'should add a documenter to the runner classes if one is specified' do |
| 54 | | # given |
| 55 | | ARGV << "--format" << "html" |
| 56 | | story_runner = mock('story runner', :null_object => true) |
| 57 | | scenario_runner = mock('scenario runner', :null_object => true) |
| 58 | | world_creator = mock('world', :null_object => true) |
| 36 | describe "initialization" do |
| 59 | 37 | |
| 60 | | @runner_module::class_eval { @world_creator = world_creator } |
| 61 | | @runner_module::StoryRunner.stub!(:new).and_return(story_runner) |
| 62 | | @runner_module::ScenarioRunner.stub!(:new).and_return(scenario_runner) |
| 38 | before(:each) do |
| 39 | # given |
| 40 | @story_runner = mock('story runner', :null_object => true) |
| 41 | @scenario_runner = mock('scenario runner', :null_object => true) |
| 42 | @world_creator = mock('world', :null_object => true) |
| 63 | 43 | |
| 64 | | # expect |
| 65 | | world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter)) |
| 66 | | story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter)) |
| 67 | | scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter)) |
| 44 | @runner_module.stub!(:world_creator).and_return(@world_creator) |
| 45 | @runner_module.stub!(:create_story_runner).and_return(@story_runner) |
| 46 | @runner_module.stub!(:scenario_runner).and_return(@scenario_runner) |
| 47 | end |
| 48 | |
| 49 | it 'should add a reporter to the runner classes' do |
| 50 | @runner_module.should_receive(:run_options).and_return( |
| 51 | create_options |
| 52 | ) |
| 68 | 53 | |
| 69 | | # when |
| 70 | | @runner_module.story_runner |
| 71 | | end |
| 54 | # expect |
| 55 | @world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter)) |
| 56 | @story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter)) |
| 57 | @scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter)) |
| 58 | |
| 59 | # when |
| 60 | @runner_module.story_runner |
| 61 | end |
| 72 | 62 | |
| 73 | | it 'should add any registered listener to the runner classes' do |
| 74 | | # given |
| 75 | | ARGV << "--format" << "html" |
| 76 | | story_runner = mock('story runner', :null_object => true) |
| 77 | | scenario_runner = mock('scenario runner', :null_object => true) |
| 78 | | world_creator = mock('world', :null_object => true) |
| 63 | it 'should add a documenter to the runner classes if one is specified' do |
| 79 | 64 | |
| 80 | | @runner_module::class_eval { @world_creator = world_creator } |
| 81 | | @runner_module::StoryRunner.stub!(:new).and_return(story_runner) |
| 82 | | @runner_module::ScenarioRunner.stub!(:new).and_return(scenario_runner) |
| 65 | @runner_module.should_receive(:run_options).and_return( |
| 66 | create_options(["--format","html"]) |
| 67 | ) |
| 68 | |
| 69 | # expect |
| 70 | @world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter)) |
| 71 | @story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter)) |
| 72 | @scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter)) |
| 83 | 73 | |
| 84 | | listener = Object.new |
| 74 | # when |
| 75 | @runner_module.story_runner |
| 76 | end |
| 77 | |
| 78 | it 'should add any registered listener to the runner classes' do |
| 79 | # given |
| 80 | listener = Object.new |
| 85 | 81 | |
| 86 | | # expect |
| 87 | | world_creator.should_receive(:add_listener).with(listener) |
| 88 | | story_runner.should_receive(:add_listener).with(listener) |
| 89 | | scenario_runner.should_receive(:add_listener).with(listener) |
| 82 | # expect |
| 83 | @world_creator.should_receive(:add_listener).with(listener) |
| 84 | @story_runner.should_receive(:add_listener).with(listener) |
| 85 | @scenario_runner.should_receive(:add_listener).with(listener) |
| 90 | 86 | |
| 91 | | # when |
| 92 | | @runner_module.register_listener listener |
| 87 | # when |
| 88 | @runner_module.register_listener listener |
| 89 | end |
| 90 | end |
| 93 | 91 | end |
| 94 | | end |
| 95 | 92 | end |
| 96 | 93 | end |
| toggle raw diff |
--- a/rspec/spec/spec/story/runner_spec.rb
+++ b/rspec/spec/spec/story/runner_spec.rb
@@ -1,29 +1,19 @@
require File.dirname(__FILE__) + '/story_helper'
+require 'spec/runner/formatter/story/plain_text_formatter'
+require 'spec/runner/formatter/story/html_formatter'
module Spec
module Story
describe Runner, "module" do
- def dev_null
- io = StringIO.new
- def io.write(str)
- str.to_s.size
- end
- return io
- end
-
- before :each do
- Kernel.stub!(:at_exit)
- @stdout, $stdout = $stdout, dev_null
- @argv = Array.new(ARGV)
- @runner_module = Runner.dup
+ before(:each) do
@world_creator = World.dup
- @runner_module.module_eval { @run_options = @story_runner = @scenario_runner = @world_creator = nil }
+ @runner_module = Runner.dup
+ @runner_module.instance_eval {@story_runner = nil}
+ @runner_module.stub!(:register_exit_hook)
end
- after :each do
- $stdout = @stdout
- ARGV.replace @argv
- @runner_module.module_eval { @run_options = @story_runner = @scenario_runner = @world_creator = nil }
+ def create_options(args=[])
+ Spec::Runner::OptionParser.parse(args, StringIO.new, StringIO.new)
end
it 'should wire up a singleton StoryRunner' do
@@ -32,75 +22,72 @@ module Spec
it 'should set its options based on ARGV' do
# given
- ARGV << '--dry-run'
-
+ @runner_module.should_receive(:run_options).and_return(
+ create_options(['--dry-run'])
+ )
+
# when
options = @runner_module.run_options
# then
options.dry_run.should be_true
end
-
- it 'should add a reporter to the runner classes' do
- # given
- story_runner = mock('story runner', :null_object => true)
- scenario_runner = mock('scenario runner', :null_object => true)
- world_creator = mock('world', :null_object => true)
-
- @runner_module::class_eval { @world_creator = world_creator }
- @runner_module::StoryRunner.stub!(:new).and_return(story_runner)
- @runner_module::ScenarioRunner.stub!(:new).and_return(scenario_runner)
-
- # expect
- world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter))
- story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter))
- scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter))
-
- # when
- @runner_module.story_runner
- end
- it 'should add a documenter to the runner classes if one is specified' do
- # given
- ARGV << "--format" << "html"
- story_runner = mock('story runner', :null_object => true)
- scenario_runner = mock('scenario runner', :null_object => true)
- world_creator = mock('world', :null_object => true)
+ describe "initialization" do
- @runner_module::class_eval { @world_creator = world_creator }
- @runner_module::StoryRunner.stub!(:new).and_return(story_runner)
- @runner_module::ScenarioRunner.stub!(:new).and_return(scenario_runner)
+ before(:each) do
+ # given
+ @story_runner = mock('story runner', :null_object => true)
+ @scenario_runner = mock('scenario runner', :null_object => true)
+ @world_creator = mock('world', :null_object => true)
- # expect
- world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter))
- story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter))
- scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter))
+ @runner_module.stub!(:world_creator).and_return(@world_creator)
+ @runner_module.stub!(:create_story_runner).and_return(@story_runner)
+ @runner_module.stub!(:scenario_runner).and_return(@scenario_runner)
+ end
+
+ it 'should add a reporter to the runner classes' do
+ @runner_module.should_receive(:run_options).and_return(
+ create_options
+ )
- # when
- @runner_module.story_runner
- end
+ # expect
+ @world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter))
+ @story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter))
+ @scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::PlainTextFormatter))
+
+ # when
+ @runner_module.story_runner
+ end
- it 'should add any registered listener to the runner classes' do
- # given
- ARGV << "--format" << "html"
- story_runner = mock('story runner', :null_object => true)
- scenario_runner = mock('scenario runner', :null_object => true)
- world_creator = mock('world', :null_object => true)
+ it 'should add a documenter to the runner classes if one is specified' do
- @runner_module::class_eval { @world_creator = world_creator }
- @runner_module::StoryRunner.stub!(:new).and_return(story_runner)
- @runner_module::ScenarioRunner.stub!(:new).and_return(scenario_runner)
+ @runner_module.should_receive(:run_options).and_return(
+ create_options(["--format","html"])
+ )
+
+ # expect
+ @world_creator.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter))
+ @story_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter))
+ @scenario_runner.should_receive(:add_listener).with(an_instance_of(Spec::Runner::Formatter::Story::HtmlFormatter))
- listener = Object.new
+ # when
+ @runner_module.story_runner
+ end
+
+ it 'should add any registered listener to the runner classes' do
+ # given
+ listener = Object.new
- # expect
- world_creator.should_receive(:add_listener).with(listener)
- story_runner.should_receive(:add_listener).with(listener)
- scenario_runner.should_receive(:add_listener).with(listener)
+ # expect
+ @world_creator.should_receive(:add_listener).with(listener)
+ @story_runner.should_receive(:add_listener).with(listener)
+ @scenario_runner.should_receive(:add_listener).with(listener)
- # when
- @runner_module.register_listener listener
+ # when
+ @runner_module.register_listener listener
+ end
+ end
end
- end
end
end |