Class: Feature
- Inherits:
-
Object
- Object
- Feature
- Defined in:
- lib/feature.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#follow_up_keyword ⇒ Object
readonly
Returns the value of attribute follow_up_keyword.
-
#given_scenario_keyword ⇒ Object
readonly
Returns the value of attribute given_scenario_keyword.
-
#keyword ⇒ Object
readonly
Returns the value of attribute keyword.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#scenario_keyword ⇒ Object
readonly
Returns the value of attribute scenario_keyword.
-
#scenarios ⇒ Object
readonly
Returns the value of attribute scenarios.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(hash = {}) ⇒ Feature
constructor
A new instance of Feature.
- #story ⇒ Object
- #story_html ⇒ Object
Constructor Details
#initialize(hash = {}) ⇒ Feature
Returns a new instance of Feature.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/feature.rb', line 8 def initialize(hash={}) @title = hash[:title] @body = hash[:body] @parent = hash[:parent] @keyword = hash[:keyword] || "Feature:" @scenario_keyword = hash[:scenario_keyword] || "Scenario:" @given_scenario_keyword = hash[:given_scenario_keyword] || "GivenScenario:" @follow_up_keyword = hash[:follow_up_keyword] || "And" raise "No title given" unless title raise "No body given" unless body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/feature.rb', line 3 def body @body end |
#follow_up_keyword ⇒ Object (readonly)
Returns the value of attribute follow_up_keyword.
3 4 5 |
# File 'lib/feature.rb', line 3 def follow_up_keyword @follow_up_keyword end |
#given_scenario_keyword ⇒ Object (readonly)
Returns the value of attribute given_scenario_keyword.
3 4 5 |
# File 'lib/feature.rb', line 3 def given_scenario_keyword @given_scenario_keyword end |
#keyword ⇒ Object (readonly)
Returns the value of attribute keyword.
3 4 5 |
# File 'lib/feature.rb', line 3 def keyword @keyword end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
3 4 5 |
# File 'lib/feature.rb', line 3 def parent @parent end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
3 4 5 |
# File 'lib/feature.rb', line 3 def parser @parser end |
#scenario_keyword ⇒ Object (readonly)
Returns the value of attribute scenario_keyword.
3 4 5 |
# File 'lib/feature.rb', line 3 def scenario_keyword @scenario_keyword end |
#scenarios ⇒ Object (readonly)
Returns the value of attribute scenarios.
3 4 5 |
# File 'lib/feature.rb', line 3 def scenarios @scenarios end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/feature.rb', line 3 def title @title end |
Instance Method Details
#story ⇒ Object
21 22 23 |
# File 'lib/feature.rb', line 21 def story body.split(/#{scenario_keyword}/)[0].split(/#{keyword}\s#{title}/).join(" ").strip end |
#story_html ⇒ Object
25 26 27 |
# File 'lib/feature.rb', line 25 def story_html story.split("\n").join(" <br />") end |