Class: CucumberMonitor::FeatureFile
- Inherits:
-
Object
- Object
- CucumberMonitor::FeatureFile
- Defined in:
- lib/cucumber_monitor/feature_file.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
Instance Method Summary collapse
- #contexts ⇒ Object
- #description ⇒ Object
-
#initialize(file) ⇒ FeatureFile
constructor
A new instance of FeatureFile.
- #lines ⇒ Object
- #name ⇒ Object
- #scenarios ⇒ Object
- #scenarios_names ⇒ Object
Constructor Details
#initialize(file) ⇒ FeatureFile
Returns a new instance of FeatureFile.
9 10 11 |
# File 'lib/cucumber_monitor/feature_file.rb', line 9 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/cucumber_monitor/feature_file.rb', line 7 def file @file end |
Instance Method Details
#contexts ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/cucumber_monitor/feature_file.rb', line 48 def contexts cont = [] lines.each do |line| if line.include?(I18n.t("background")) cont << Context.new(line.clean,self.class.new(file)) end end cont end |
#description ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/cucumber_monitor/feature_file.rb', line 24 def description desc = "" lines.each do |line| if line.include?(I18n.t("feature")) desc = line.clean end end desc end |
#lines ⇒ Object
17 18 19 20 21 22 |
# File 'lib/cucumber_monitor/feature_file.rb', line 17 def lines f = open(CucumberMonitor::Base.features_path + '/' + file) file_lines = f.readlines f.close file_lines end |
#name ⇒ Object
13 14 15 |
# File 'lib/cucumber_monitor/feature_file.rb', line 13 def name file[0..-9] end |
#scenarios ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/cucumber_monitor/feature_file.rb', line 34 def scenarios scen = [] lines.each do |line| if line.include?(I18n.t("scenario")) scen << Scenario.new(line.clean,self.class.new(file)) end end scen end |
#scenarios_names ⇒ Object
44 45 46 |
# File 'lib/cucumber_monitor/feature_file.rb', line 44 def scenarios_names scenarios.map(&:name) end |