Class: Marso::Feature
- Includes:
- FeatureLoad, FeaturePublish
- Defined in:
- lib/marso/domain/feature/feature.rb
Instance Attribute Summary collapse
-
#color_theme ⇒ Object
readonly
Returns the value of attribute color_theme.
-
#ctx ⇒ Object
readonly
Returns the value of attribute ctx.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#fname ⇒ Object
readonly
Returns the value of attribute fname.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rootpath ⇒ Object
readonly
Returns the value of attribute rootpath.
-
#scenario_contexts ⇒ Object
readonly
Returns the value of attribute scenario_contexts.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#stories ⇒ Object
readonly
Returns the value of attribute stories.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#tree_position ⇒ Object
readonly
Returns the value of attribute tree_position.
Instance Method Summary collapse
-
#all_scenario_contexts ⇒ Object
Returns the combination of the feature’s scenario contexts and the scenario contexts under each feature’s stories.
-
#initialize(description = {}, ctx = {}) ⇒ Feature
constructor
description (optional): Hash defined as follow :id => Arbitrary number or string.
-
#stories_scenario_contexts ⇒ Object
Returns all the scenario contexts under each feature’s stories.
Methods included from FeaturePublish
#colorized_text, #indented_colorized_details
Methods included from TextHelper
#colorized_text, #indented_colorized_text
Methods included from FeatureLoad
Constructor Details
#initialize(description = {}, ctx = {}) ⇒ Feature
description (optional): Hash defined as follow
:id => Arbitrary number or string. Default is randomly generated
(hex string (length 6))
:name => Feature's name
:in_order_to => String that describes the fundamental story's business
value
:as_a => String that describes the user(s)
:i => String that describes the feature that could deliver the story's
business value(e.g. I want ... or I should ...)
:stories => Array of all the stories that are part of that feature
:scenario_contexts => Array of all the scenario contexts that are part
of that feature
:rootpath => Path to the folder that contain this current feature's file
as well as its associated 'scenarios' and 'stories' folder
:status => Can only be set if both :scenario_contexts and :stories are
empty. Otherwise, it will be overidden by the status of
either :scenario_contexts or :stories
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/marso/domain/feature/feature.rb', line 32 def initialize(description={}, ctx={}) validate_arguments(description, ctx) @description = description.clone @ctx = ctx.clone @description[:scenario_contexts] = [] if description[:scenario_contexts].nil? @description[:stories] = [] if description[:stories].nil? @description[:id] = SecureRandom.hex(3) if description[:id].nil? @description[:rootpath] = File.dirname(caller[0]) if description[:rootpath].nil? @name = @description[:name] @fname = @description[:name].downcase.gsub(' ', '_') @rootpath = @description[:rootpath] @id = @description[:id] @scenario_contexts = @description[:scenario_contexts] @stories = @description[:stories] if @scenario_contexts.empty? && @stories.empty? && !@description[:status].nil? @status = @description[:status] else @status = Marso.item_with_stronger_status(@stories, @scenario_contexts).status end @tree_position = 0 @header = get_header(@id, @status, @description) @color_theme = get_color_theme(@status) @text = get_text(@header, @description) end |
Instance Attribute Details
#color_theme ⇒ Object (readonly)
Returns the value of attribute color_theme.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def color_theme @color_theme end |
#ctx ⇒ Object (readonly)
Returns the value of attribute ctx.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def ctx @ctx end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def description @description end |
#fname ⇒ Object (readonly)
Returns the value of attribute fname.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def fname @fname end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def header @header end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def name @name end |
#rootpath ⇒ Object (readonly)
Returns the value of attribute rootpath.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def rootpath @rootpath end |
#scenario_contexts ⇒ Object (readonly)
Returns the value of attribute scenario_contexts.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def scenario_contexts @scenario_contexts end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def status @status end |
#stories ⇒ Object (readonly)
Returns the value of attribute stories.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def stories @stories end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def text @text end |
#tree_position ⇒ Object (readonly)
Returns the value of attribute tree_position.
12 13 14 |
# File 'lib/marso/domain/feature/feature.rb', line 12 def tree_position @tree_position end |
Instance Method Details
#all_scenario_contexts ⇒ Object
Returns the combination of the feature’s scenario contexts and the scenario contexts under each feature’s stories
64 65 66 |
# File 'lib/marso/domain/feature/feature.rb', line 64 def all_scenario_contexts @scenario_contexts | self.stories_scenario_contexts end |
#stories_scenario_contexts ⇒ Object
Returns all the scenario contexts under each feature’s stories
69 70 71 |
# File 'lib/marso/domain/feature/feature.rb', line 69 def stories_scenario_contexts @stories.map { |s| s.scenario_contexts }.flatten end |