Class: Spec::Story::Story

Class | Spec::Story::Story
In: | lib/spec/story/story.rb
Parent: | Object

### Methods

[] assign_steps_to new run_in steps_for

### Attributes

narrative | [R] |
title | [R] |

### Public Class methods

new(title, narrative, params = {}, &body)

[Source]

        # File lib/spec/story/story.rb, line 6
     6:       def initialize(title, narrative, params = {}, &body)
     7:         @body = body
     8:         @title = title
     9:         @narrative = narrative
    10:         @params = params
    11:       end

### Public Instance methods

[](key)

[Source]

        # File lib/spec/story/story.rb, line 13
    13:       def [](key)
    14:         @params[key]
    15:       end

assign_steps_to(assignee)

[Source]

        # File lib/spec/story/story.rb, line 21
    21:       def assign_steps_to(assignee)
    22:         if @params[:steps]
    23:           assignee.use(@params[:steps])
    24:         else
    25:           case keys = @params[:steps_for]
    26:           when Symbol
    27:             keys = [keys]
    28:           when nil
    29:             keys = []
    30:           end
    31:           keys.each do |key|
    32:             assignee.use(steps_for(key))
    33:           end
    34:         end
    35:       end

run_in(obj)

[Source]

        # File lib/spec/story/story.rb, line 17
    17:       def run_in(obj)
    18:         obj.instance_eval(&@body)
    19:       end

steps_for(key)

[Source]

        # File lib/spec/story/story.rb, line 37
    37:       def steps_for(key)
    38:         $rspec_story_steps[key]
    39:       end

[Validate]