Class: CucumberMonitor::StepDefinitionFile
- Inherits:
-
Object
- Object
- CucumberMonitor::StepDefinitionFile
- Defined in:
- lib/cucumber_monitor/step_definition_file.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#path ⇒ Object
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #definitions ⇒ Object
-
#initialize(file, path) ⇒ StepDefinitionFile
constructor
A new instance of StepDefinitionFile.
- #lines ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(file, path) ⇒ StepDefinitionFile
Returns a new instance of StepDefinitionFile.
13 14 15 16 |
# File 'lib/cucumber_monitor/step_definition_file.rb', line 13 def initialize(file,path) @file = file @path = path end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/cucumber_monitor/step_definition_file.rb', line 7 def file @file end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/cucumber_monitor/step_definition_file.rb', line 7 def path @path end |
Class Method Details
.keywords ⇒ Object
9 10 11 |
# File 'lib/cucumber_monitor/step_definition_file.rb', line 9 def self.keywords [I18n.t("given"), I18n.t("when"), I18n.t("then"), I18n.t("and"), I18n.t("but")].collect{|c| c[2..-1]} end |
Instance Method Details
#definitions ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/cucumber_monitor/step_definition_file.rb', line 29 def definitions df = [] lines.each_with_index do |line,i| if self.class.keywords.any?{|k| line.include?(k)} df << Definition.new(line.strip,self,i+1) end end df end |
#lines ⇒ Object
22 23 24 25 26 27 |
# File 'lib/cucumber_monitor/step_definition_file.rb', line 22 def lines f = open(CucumberMonitor::Base.step_definitions_path + '/' + file) file_lines = f.readlines f.close file_lines end |
#name ⇒ Object
18 19 20 |
# File 'lib/cucumber_monitor/step_definition_file.rb', line 18 def name file[0..-9] end |