Class: CucumberMonitor::Scenario

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, feature) ⇒ Scenario

Returns a new instance of Scenario.



9
10
11
12
13
# File 'lib/cucumber_monitor/scenario.rb', line 9

def initialize(name,feature)
  @name = name
  @keyword = I18n.t("scenario")
  @feature = feature
end

Instance Attribute Details

#featureObject

Returns the value of attribute feature.



7
8
9
# File 'lib/cucumber_monitor/scenario.rb', line 7

def feature
  @feature
end

#keywordObject

Returns the value of attribute keyword.



7
8
9
# File 'lib/cucumber_monitor/scenario.rb', line 7

def keyword
  @keyword
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/cucumber_monitor/scenario.rb', line 7

def name
  @name
end

Instance Method Details



34
35
36
37
38
39
# File 'lib/cucumber_monitor/scenario.rb', line 34

def print_steps
  steps.each do |step|
    puts step
  end
  nil
end

#stepsObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cucumber_monitor/scenario.rb', line 15

def steps
  st = []
  started = false
  stopped = false
  record = false
  count = 0
  feature.lines.each_with_index do |line, i|
    if line.include?(name)
      started = true
    end
    if started && !stopped
      st << Step.new(line.strip, self, i+1) unless (count == 0 || line.strip.blank?)
      stopped = true if line.strip.blank?
      count += 1
    end
  end
  st
end