Class: Spec::Story::StepMother
- Inherits:
-
Object
- Object
- Spec::Story::StepMother
- Defined in:
- lib/spec/story/step_mother.rb
Instance Method Summary collapse
- #clear ⇒ Object
- #empty? ⇒ Boolean
- #find(type, unstripped_name) ⇒ Object
-
#initialize ⇒ StepMother
constructor
A new instance of StepMother.
- #store(type, step) ⇒ Object
- #use(new_step_group) ⇒ Object
Constructor Details
#initialize ⇒ StepMother
Returns a new instance of StepMother.
4 5 6 |
# File 'lib/spec/story/step_mother.rb', line 4 def initialize @steps = StepGroup.new end |
Instance Method Details
#clear ⇒ Object
28 29 30 |
# File 'lib/spec/story/step_mother.rb', line 28 def clear @steps.clear end |
#empty? ⇒ Boolean
32 33 34 |
# File 'lib/spec/story/step_mother.rb', line 32 def empty? @steps.empty? end |
#find(type, unstripped_name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/spec/story/step_mother.rb', line 16 def find(type, unstripped_name) name = unstripped_name.strip if @steps.find(type, name).nil? @steps.add(type, Step.new(name) do raise Spec::Example::ExamplePendingError.new("Unimplemented step: #{name}") end ) end @steps.find(type, name) end |
#store(type, step) ⇒ Object
12 13 14 |
# File 'lib/spec/story/step_mother.rb', line 12 def store(type, step) @steps.add(type, step) end |
#use(new_step_group) ⇒ Object
8 9 10 |
# File 'lib/spec/story/step_mother.rb', line 8 def use(new_step_group) @steps << new_step_group end |