Class: Spec::Story::Story
- Defined in:
- lib/gems/rspec-1.1.11/lib/spec/story/story.rb
Instance Attribute Summary collapse
-
#narrative ⇒ Object
readonly
Returns the value of attribute narrative.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #assign_steps_to(assignee) ⇒ Object
-
#initialize(title, narrative, params = {}, &body) ⇒ Story
constructor
A new instance of Story.
- #run_in(obj) ⇒ Object
- #steps_for(key) ⇒ Object
Constructor Details
#initialize(title, narrative, params = {}, &body) ⇒ Story
Returns a new instance of Story.
6 7 8 9 10 11 |
# File 'lib/gems/rspec-1.1.11/lib/spec/story/story.rb', line 6 def initialize(title, narrative, params = {}, &body) @body = body @title = title @narrative = narrative @params = params end |
Instance Attribute Details
#narrative ⇒ Object (readonly)
Returns the value of attribute narrative.
4 5 6 |
# File 'lib/gems/rspec-1.1.11/lib/spec/story/story.rb', line 4 def narrative @narrative end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/gems/rspec-1.1.11/lib/spec/story/story.rb', line 4 def title @title end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/gems/rspec-1.1.11/lib/spec/story/story.rb', line 13 def [](key) @params[key] end |
#assign_steps_to(assignee) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gems/rspec-1.1.11/lib/spec/story/story.rb', line 21 def assign_steps_to(assignee) if steps=@params[:steps_for] steps = [steps] unless steps.is_a?(Array) steps.each do |step| if step.is_a?(StepGroup) assignee.use(step) else assignee.use(steps_for(step)) end end end end |
#run_in(obj) ⇒ Object
17 18 19 |
# File 'lib/gems/rspec-1.1.11/lib/spec/story/story.rb', line 17 def run_in(obj) obj.instance_eval(&@body) end |