1 require File.dirname(__FILE__) + '/story_helper'
6 it 'should store a step by name and type' do
8 step_mother = StepMother.new
9 step = Step.new("a given", &lambda {})
10 step_mother.store(:given, step)
13 found = step_mother.find(:given, "a given")
19 it 'should NOT raise an error if a step is missing' do
21 step_mother = StepMother.new
26 step_mother.find(:given, "doesn't exist")
27 end.should_not raise_error
30 it "should create a default step which raises a pending error" do
32 step_mother = StepMother.new
35 step = step_mother.find(:given, "doesn't exist")
38 step.should be_an_instance_of(Step)
41 step.perform(Object.new, "doesn't exist")
42 end.should raise_error(Spec::Example::ExamplePendingError, /Unimplemented/)
45 it 'should clear itself' do
47 step_mother = StepMother.new
48 step = Step.new("a given") do end
49 step_mother.store(:given, step)
55 step_mother.should be_empty
58 it "should use assigned steps" do
59 step_mother = StepMother.new
61 step = Step.new('step') {}
62 step_group = StepGroup.new
63 step_group.add(:given, step)
65 step_mother.use(step_group)
67 step_mother.find(:given, "step").should equal(step)