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

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

Overview

:nodoc:

Defined Under Namespace

Classes: InvalidForHeaderRowError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, cells) ⇒ ExampleRow

Returns a new instance of ExampleRow.



77
78
79
80
# File 'lib/cucumber/ast/outline_table.rb', line 77

def initialize(table, cells)
  super
  @scenario_exception = nil
end

Instance Attribute Details

#scenario_outlineObject (readonly)



75
76
77
# File 'lib/cucumber/ast/outline_table.rb', line 75

def scenario_outline
  @scenario_outline
end

Instance Method Details

#accept(visitor) ⇒ Object



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

def accept(visitor)
  return if Cucumber.wants_to_quit
  visitor.configuration.expand? ? accept_expand(visitor) : accept_plain(visitor)
end

#accept_expand(visitor) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/cucumber/ast/outline_table.rb', line 124

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

#accept_hook?(hook) ⇒ Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/cucumber/ast/outline_table.rb', line 138

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

#accept_plain(visitor) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/cucumber/ast/outline_table.rb', line 102

def accept_plain(visitor)
  if header?
    @cells.each do |cell|
      cell.status = :skipped_param
      visitor.visit_table_cell(cell)
    end
  else
    visitor.step_mother.with_hooks(self) do
      @step_invocations.each do |step_invocation|
        step_invocation.invoke(visitor.step_mother, visitor.configuration)
        @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



167
168
169
# File 'lib/cucumber/ast/outline_table.rb', line 167

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

#create_step_invocations!(scenario_outline) ⇒ Object



86
87
88
89
# File 'lib/cucumber/ast/outline_table.rb', line 86

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

#exceptionObject



142
143
144
# File 'lib/cucumber/ast/outline_table.rb', line 142

def exception
  @exception || @scenario_exception
end

#fail!(exception) ⇒ Object



146
147
148
# File 'lib/cucumber/ast/outline_table.rb', line 146

def fail!(exception)
  @scenario_exception = exception
end

#failed?Boolean

Returns true if one or more steps failed

Returns:

  • (Boolean)

Raises:



151
152
153
154
# File 'lib/cucumber/ast/outline_table.rb', line 151

def failed?
  raise InvalidForHeaderRowError if header?
  @step_invocations.failed? || !!@scenario_exception
end

#languageObject



175
176
177
# File 'lib/cucumber/ast/outline_table.rb', line 175

def language
  @table.language
end

#nameObject



171
172
173
# File 'lib/cucumber/ast/outline_table.rb', line 171

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

#passed?Boolean

Returns true if all steps passed

Returns:

  • (Boolean)


157
158
159
# File 'lib/cucumber/ast/outline_table.rb', line 157

def passed?
  !failed?
end

#skip_invoke!Object



91
92
93
94
95
# File 'lib/cucumber/ast/outline_table.rb', line 91

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

#source_tag_namesObject



82
83
84
# File 'lib/cucumber/ast/outline_table.rb', line 82

def source_tag_names
  @table.source_tag_names
end

#statusObject

Returns the status



162
163
164
165
# File 'lib/cucumber/ast/outline_table.rb', line 162

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