1
require File.dirname(__FILE__) + '/story_helper'
6
it 'should run itself in a given object' do
9
story = Story.new 'title', 'narrative' do
18
$instance.should be(object)
21
it 'should not raise an error if no block is supplied' do
23
error = exception_from do
24
Story.new 'title', 'narrative'
31
it "should raise when error raised running in another object" do
33
story = Story.new 'title', 'narrative' do
34
raise "this is raised in the story"
41
end.should raise_error
44
it "should use the steps it is told to using a StepGroup" do
45
story = Story.new("title", "narrative", :steps => steps = StepGroup.new) do end
46
assignee = mock("assignee")
47
assignee.should_receive(:use).with(steps)
48
story.assign_steps_to(assignee)
51
it "should use the steps it is told to using a key" do
53
orig_rspec_story_steps = $rspec_story_steps
54
$rspec_story_steps = StepGroupHash.new
55
$rspec_story_steps[:foo] = steps = Object.new
57
story = Story.new("title", "narrative", :steps_for => :foo) do end
58
assignee = mock("assignee")
60
assignee.should_receive(:use).with(steps)
61
story.assign_steps_to(assignee)
63
$rspec_story_steps = orig_rspec_story_steps
67
it "should use the steps it is told to using multiple keys" do
69
orig_rspec_story_steps = $rspec_story_steps
70
$rspec_story_steps = StepGroupHash.new
71
$rspec_story_steps[:foo] = foo_steps = Object.new
72
$rspec_story_steps[:bar] = bar_steps = Object.new
74
story = Story.new("title", "narrative", :steps_for => [:foo, :bar]) do end
75
assignee = mock("assignee")
77
assignee.should_receive(:use).with(foo_steps)
78
assignee.should_receive(:use).with(bar_steps)
79
story.assign_steps_to(assignee)
81
$rspec_story_steps = orig_rspec_story_steps