Class: Lime::Feature::Scope
Instance Method Summary collapse
-
#_feature ⇒ Object
Access to underlying feature instance.
- #As(description) ⇒ Object (also: #as)
-
#Given(description, &procedure) ⇒ Object
(also: #given)
Given …
-
#include(mixin) ⇒ Object
Include module and if a Featurette, also update Feature instance.
-
#initialize(feature, &block) ⇒ Scope
constructor
A new instance of Scope.
-
#Scenario(label, &procedure) ⇒ Object
(also: #scenario)
Define a Scenario.
-
#skip(reason = true) ⇒ Object
Skip the next scenario when running feature.
-
#Then(description, &procedure) ⇒ Object
(also: #hence)
Then …
- #To(description) ⇒ Object (also: #to)
- #We(description) ⇒ Object (also: #we, #I)
-
#When(description, &procedure) ⇒ Object
(also: #wence)
When …
Constructor Details
#initialize(feature, &block) ⇒ Scope
Returns a new instance of Scope.
88 89 90 91 92 93 |
# File 'lib/lime/feature.rb', line 88 def initialize(feature, &block) @_feature = feature @_skip = false module_eval(&block) if block end |
Instance Method Details
#_feature ⇒ Object
Access to underlying feature instance.
184 185 186 |
# File 'lib/lime/feature.rb', line 184 def _feature @_feature end |
#As(description) ⇒ Object Also known as: as
103 104 105 |
# File 'lib/lime/feature.rb', line 103 def As(description) @_feature.story << "As " + description end |
#Given(description, &procedure) ⇒ Object Also known as: given
Given …
141 142 143 |
# File 'lib/lime/feature.rb', line 141 def Given(description, &procedure) @_feature[:given][description] = procedure end |
#include(mixin) ⇒ Object
Include module and if a Featurette, also update Feature instance.
191 192 193 194 195 196 |
# File 'lib/lime/feature.rb', line 191 def include(mixin) if Featurette === mixin @_feature.update(mixin) end super(mixin) end |
#Scenario(label, &procedure) ⇒ Object Also known as: scenario
Define a Scenario.
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/lime/feature.rb', line 122 def Scenario(label, &procedure) scenario = Scenario.new( @_feature, :skip => @_skip, :label => label, &procedure ) @_feature.scenarios << scenario @_skip = false scenario end |
#skip(reason = true) ⇒ Object
TODO:
Use block form of this instead?
Skip the next scenario when running feature.
skip "for some reason"
Scenario "blah blah blah" do
# ...
end
177 178 179 |
# File 'lib/lime/feature.rb', line 177 def skip(reason=true) @_skip = reason end |
#Then(description, &procedure) ⇒ Object Also known as: hence
Then …
163 164 165 |
# File 'lib/lime/feature.rb', line 163 def Then(description, &procedure) @_feature[:then][description] = procedure end |
#To(description) ⇒ Object Also known as: to
96 97 98 |
# File 'lib/lime/feature.rb', line 96 def To(description) @_feature.story << "To " + description end |
#We(description) ⇒ Object Also known as: we, I
110 111 112 |
# File 'lib/lime/feature.rb', line 110 def We(description) @_feature.story << "We " + description end |
#When(description, &procedure) ⇒ Object Also known as: wence
When …
152 153 154 |
# File 'lib/lime/feature.rb', line 152 def When(description, &procedure) @_feature[:when][description] = procedure end |