Class: Cucumber::Tree::BaseScenario

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb

Direct Known Subclasses

RowScenario, Scenario

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#featureObject (readonly)

Returns the value of attribute feature.



4
5
6
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb', line 4

def feature
  @feature
end

Instance Method Details

#accept(visitor) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb', line 10

def accept(visitor)
  steps.each do |step|
    if step.outline? && !step.row?
      visitor.visit_step_outline(step)
    elsif step.row?
      visitor.visit_row_step(step)
    else
      visitor.visit_regular_step(step)
    end
  end
end

#at_line?(l) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb', line 22

def at_line?(l)
  line == l || steps.map{|s| s.line}.index(l)
end

#fileObject



6
7
8
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb', line 6

def file
  @feature.file
end

#outline?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb', line 36

def outline?
  false
end

#pending?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb', line 32

def pending?
  steps.empty?
end

#previous_step(step) ⇒ Object



26
27
28
29
30
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/tree/scenario.rb', line 26

def previous_step(step)
  i = steps.index(step)
  raise "Couldn't find #{step} among #{steps}" if i.nil?
  steps[i-1]
end