Class: CucumberMonitor::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber_monitor/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.cucumber_output_fileObject



14
15
16
# File 'lib/cucumber_monitor/base.rb', line 14

def self.cucumber_output_file
  "#{path}/tmp/cucumber.out"
end

.features_pathObject



10
11
12
# File 'lib/cucumber_monitor/base.rb', line 10

def self.features_path
  "#{path}/features"
end

.pathObject



6
7
8
# File 'lib/cucumber_monitor/base.rb', line 6

def self.path
  CucumberMonitor.path
end

Instance Method Details

#featuresObject



37
38
39
40
41
42
43
# File 'lib/cucumber_monitor/base.rb', line 37

def features
  collection = []
  files.each do |file|
    collection << CucumberMonitor::FeatureFile.new(file)  
  end
  collection
end

#filesObject



22
23
24
25
26
# File 'lib/cucumber_monitor/base.rb', line 22

def files
  collection = []
  dir_entries = Dir.entries(self.class.features_path)
  search_and_include_features(dir_entries)
end

#locateObject



18
19
20
# File 'lib/cucumber_monitor/base.rb', line 18

def locate
  "Printing: #{I18n.t("feature")}"
end

#search(criteria) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/cucumber_monitor/base.rb', line 45

def search(criteria)
  results = []
  features.each do |feature|
    feature.scenarios.each do |scenario|
      scenario.steps.each do |step|
        results << step if step.description.include?(criteria)
      end
    end
  end
  results
end

#search_and_include_features(dir_entries, collection = []) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/cucumber_monitor/base.rb', line 28

def search_and_include_features(dir_entries, collection=[])
  dir_entries.each do |entrie|
    if entrie.include?('.feature')
      collection << entrie
    end
  end
  collection
end