Class: Spec::Story::Runner::StoryMediator::Scenario

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/story/runner/story_mediator.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Scenario

Returns a new instance of Scenario.



93
94
95
96
# File 'lib/spec/story/runner/story_mediator.rb', line 93

def initialize(name)
  @name = name
  @steps = []
end

Instance Method Details

#add_step(step) ⇒ Object



108
109
110
# File 'lib/spec/story/runner/story_mediator.rb', line 108

def add_step(step)
  @steps << step
end

#last_stepObject



112
113
114
# File 'lib/spec/story/runner/story_mediator.rb', line 112

def last_step
  @steps.last
end

#to_procObject



98
99
100
101
102
103
104
105
106
# File 'lib/spec/story/runner/story_mediator.rb', line 98

def to_proc
  name = @name
  steps = @steps.collect { |step| step.to_proc }
  lambda do
    Scenario name do
      steps.each { |step| instance_eval(&step) }
    end
  end
end