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.



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

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

Instance Attribute Details

#scenario_outlineObject (readonly)



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

def scenario_outline
  @scenario_outline
end

Instance Method Details

#accept(visitor) ⇒ Object



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

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

#accept_expand(visitor) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/cucumber/ast/outline_table.rb', line 132

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

#accept_hook?(hook) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#accept_plain(visitor) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/cucumber/ast/outline_table.rb', line 110

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



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

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

#create_step_invocations!(scenario_outline) ⇒ Object



94
95
96
97
# File 'lib/cucumber/ast/outline_table.rb', line 94

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

#exceptionObject



149
150
151
# File 'lib/cucumber/ast/outline_table.rb', line 149

def exception
  @exception || @scenario_exception
end

#fail!(exception) ⇒ Object



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

def fail!(exception)
  @scenario_exception = exception
end

#failed?Boolean

Returns true if one or more steps failed

Returns:

  • (Boolean)

Raises:



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

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

#languageObject



182
183
184
# File 'lib/cucumber/ast/outline_table.rb', line 182

def language
  @table.language
end

#nameObject



178
179
180
# File 'lib/cucumber/ast/outline_table.rb', line 178

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

#passed?Boolean

Returns true if all steps passed

Returns:

  • (Boolean)


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

def passed?
  !failed?
end

#skip_invoke!Object



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

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

#source_tag_namesObject



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

def source_tag_names
  source_tags.map { |tag| tag.name }
end

#source_tagsObject



90
91
92
# File 'lib/cucumber/ast/outline_table.rb', line 90

def source_tags
  @table.source_tags
end

#statusObject

Returns the status



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

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