Class: Cucumber::Ast::OutlineTable::ExampleRow

Inherits:
Cells
  • Object
show all
Defined in:
lib/cucumber/ast/outline_table.rb

Instance Method Summary collapse

Instance Method Details

#accept(visitor) ⇒ Object



59
60
61
# File 'lib/cucumber/ast/outline_table.rb', line 59

def accept(visitor)
  visitor.options[:expand] ? accept_expand(visitor) : accept_plain(visitor)
end

#accept_expand(visitor) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/cucumber/ast/outline_table.rb', line 85

def accept_expand(visitor)
  if header?
  else
    visitor.step_mother.before_and_after(self) do
      @table.visit_scenario_name(visitor, self)
      @step_invocations.each do |step_invocation|
        step_invocation.invoke(visitor.step_mother, visitor.options)
        @exception ||= step_invocation.reported_exception
        step_invocation.visit_step_result(visitor)
      end
    end
  end
end

#accept_hook?(hook) ⇒ Boolean

Returns:

  • (Boolean)


99
100
101
# File 'lib/cucumber/ast/outline_table.rb', line 99

def accept_hook?(hook)
  @table.accept_hook?(hook)
end

#accept_plain(visitor) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/cucumber/ast/outline_table.rb', line 63

def accept_plain(visitor)
  if header?
    @cells.each do |cell|
      cell.status = :skipped_param
      visitor.visit_table_cell(cell)
    end
  else
    visitor.step_mother.before_and_after(self) do
      @step_invocations.each do |step_invocation|
        step_invocation.invoke(visitor.step_mother, visitor.options)
        @exception ||= step_invocation.reported_exception
      end

      @cells.each do |cell|
        visitor.visit_table_cell(cell)
      end
      
      visitor.visit_exception(@scenario_exception, :failed) if @scenario_exception
    end
  end
end

#backtrace_lineObject



127
128
129
# File 'lib/cucumber/ast/outline_table.rb', line 127

def backtrace_line
  @scenario_outline.backtrace_line(name, line)
end

#create_step_invocations!(scenario_outline) ⇒ Object



48
49
50
51
# File 'lib/cucumber/ast/outline_table.rb', line 48

def create_step_invocations!(scenario_outline)
  @scenario_outline = scenario_outline
  @step_invocations = scenario_outline.step_invocations(self)
end

#exceptionObject



103
104
105
# File 'lib/cucumber/ast/outline_table.rb', line 103

def exception
  @exception || @scenario_exception
end

#fail!(exception) ⇒ Object



107
108
109
# File 'lib/cucumber/ast/outline_table.rb', line 107

def fail!(exception)
  @scenario_exception = exception
end

#failed?Boolean

Returns true if one or more steps failed

Returns:

  • (Boolean)


112
113
114
# File 'lib/cucumber/ast/outline_table.rb', line 112

def failed?
  @step_invocations.failed? || !!@scenario_exception
end

#nameObject



131
132
133
# File 'lib/cucumber/ast/outline_table.rb', line 131

def name
  "| #{@cells.collect{|c| c.value }.join(' | ')} |"
end

#passed?Boolean

Returns true if all steps passed

Returns:

  • (Boolean)


117
118
119
# File 'lib/cucumber/ast/outline_table.rb', line 117

def passed?
  !failed?
end

#skip_invoke!Object



53
54
55
56
57
# File 'lib/cucumber/ast/outline_table.rb', line 53

def skip_invoke!
  @step_invocations.each do |step_invocation|
    step_invocation.skip_invoke!
  end
end

#statusObject

Returns the status



122
123
124
125
# File 'lib/cucumber/ast/outline_table.rb', line 122

def status
  return :failed if @scenario_exception
  @step_invocations.status
end