cucumber 4.0.0.rc.1 → 4.0.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,13 +10,16 @@ module Cucumber
10
10
  bin/cucumber:
11
11
  lib/rspec
12
12
  gems/
13
+ site_ruby/
13
14
  minitest
14
15
  test/unit
15
16
  .gem/ruby
16
- lib/ruby/
17
17
  bin/bundle
18
18
  ]
19
19
 
20
+ @backtrace_filters << RbConfig::CONFIG['rubyarchdir'] if RbConfig::CONFIG['rubyarchdir']
21
+ @backtrace_filters << RbConfig::CONFIG['rubylibdir'] if RbConfig::CONFIG['rubylibdir']
22
+
20
23
  @backtrace_filters << 'org/jruby/' if ::Cucumber::JRUBY
21
24
 
22
25
  BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.join('|'))
@@ -143,7 +143,7 @@ module Cucumber
143
143
  return unless config.wip?
144
144
  messages = passed_test_cases.map do |test_case|
145
145
  scenario_source = ast_lookup.scenario_source(test_case)
146
- keyword = scenario_source.type == :Scenario ? scenario_source.scenario[:keyword] : scenario_source.scenario_outline[:keyword]
146
+ keyword = scenario_source.type == :Scenario ? scenario_source.scenario.keyword : scenario_source.scenario_outline.keyword
147
147
  linebreaks("#{test_case.location.on_line(test_case.location.lines.max)}:in `#{keyword}: #{test_case.name}'", ENV['CUCUMBER_TRUNCATE_OUTPUT'].to_i)
148
148
  end
149
149
  do_print_passing_wip(messages)
@@ -37,7 +37,7 @@ module Cucumber
37
37
  return [] if test_cases.empty?
38
38
  [format_string("#{type_heading(type)} Scenarios:", type)] + test_cases.map do |test_case|
39
39
  scenario_source = @ast_lookup.scenario_source(test_case)
40
- keyword = scenario_source.type == :Scenario ? scenario_source.scenario[:keyword] : scenario_source.scenario_outline[:keyword]
40
+ keyword = scenario_source.type == :Scenario ? scenario_source.scenario.keyword : scenario_source.scenario_outline.keyword
41
41
  source = @config.source? ? format_string(" # #{keyword}: #{test_case.name}", :comment) : ''
42
42
  format_string("cucumber #{profiles_string}#{test_case.location.file}:#{test_case.location.lines.max}", type) + source
43
43
  end
@@ -8,7 +8,7 @@ module Cucumber
8
8
  # <tt>time</tt> format.
9
9
  def format_duration(seconds)
10
10
  m, s = seconds.divmod(60)
11
- "#{m}m#{format('%.3f', s)}s"
11
+ "#{m}m#{format('%<seconds>.3f', seconds: s)}s"
12
12
  end
13
13
  end
14
14
  end
@@ -24,6 +24,8 @@ module Cucumber
24
24
  def duration(duration, *)
25
25
  duration.tap { |dur| @result_duration = dur.nanoseconds / 10**9.0 }
26
26
  end
27
+
28
+ def embed(*) end
27
29
  end
28
30
  end
29
31
  end
@@ -18,19 +18,6 @@ module Cucumber
18
18
  end
19
19
  end
20
20
 
21
- # @deprecated use #buffer_string
22
- def buffer
23
- require 'cucumber/deprecate.rb'
24
- Cucumber.deprecate(
25
- 'Use Cucumber::Formatter::Interceptor::Pipe#buffer_string instead',
26
- 'Cucumber::Formatter::Interceptor::Pipe#buffer',
27
- '3.99'
28
- )
29
- lock.synchronize do
30
- return @buffer.string.lines
31
- end
32
- end
33
-
34
21
  def buffer_string
35
22
  lock.synchronize do
36
23
  return @buffer.string.dup
@@ -163,33 +163,34 @@ module Cucumber
163
163
  def create_step_hash(test_step)
164
164
  step_source = @ast_lookup.step_source(test_step).step
165
165
  step_hash = {
166
- keyword: step_source[:keyword],
166
+ keyword: step_source.keyword,
167
167
  name: test_step.text,
168
168
  line: test_step.location.lines.min
169
169
  }
170
- step_hash[:doc_string] = create_doc_string_hash(step_source[:doc_string]) unless step_source[:doc_string].nil?
171
- step_hash[:rows] = create_data_table_value(step_source[:data_table]) unless step_source[:data_table].nil?
170
+ step_hash[:doc_string] = create_doc_string_hash(step_source.doc_string) unless step_source.doc_string.nil?
171
+ step_hash[:rows] = create_data_table_value(step_source.data_table) unless step_source.data_table.nil?
172
172
  step_hash
173
173
  end
174
174
 
175
175
  def create_doc_string_hash(doc_string)
176
- content_type = doc_string[:content_type] || ''
176
+ content_type = doc_string.content_type || ''
177
177
  {
178
- value: doc_string[:content],
178
+ value: doc_string.content,
179
179
  content_type: content_type,
180
- line: doc_string[:location][:line]
180
+ line: doc_string.location.line
181
181
  }
182
182
  end
183
183
 
184
184
  def create_data_table_value(data_table)
185
- data_table[:rows].map do |row|
186
- { cells: row[:cells].map { |cell| cell[:value] } }
185
+ data_table.rows.map do |row|
186
+ { cells: row.cells.map(&:value) }
187
187
  end
188
188
  end
189
189
 
190
190
  def add_match_and_result(test_step, result)
191
191
  @step_or_hook_hash[:match] = create_match_hash(test_step, result)
192
192
  @step_or_hook_hash[:result] = create_result_hash(result)
193
+ result.embeddings.each { |e| embed(e['src'], e['mime_type'], e['label']) } if result.respond_to?(:embeddings)
193
194
  end
194
195
 
195
196
  def add_failed_around_hook(result)
@@ -230,9 +231,9 @@ module Cucumber
230
231
  def initialize(test_case, ast_lookup)
231
232
  @background_hash = nil
232
233
  uri = test_case.location.file
233
- feature = ast_lookup.gherkin_document(uri)[:feature]
234
+ feature = ast_lookup.gherkin_document(uri).feature
234
235
  feature(feature, uri)
235
- background(feature[:children].first[:background]) unless feature[:children].first[:background].nil?
236
+ background(feature.children.first.background) unless feature.children.first.background.nil?
236
237
  scenario(ast_lookup.scenario_source(test_case), test_case)
237
238
  end
238
239
 
@@ -242,23 +243,23 @@ module Cucumber
242
243
 
243
244
  def feature(feature, uri)
244
245
  @feature_hash = {
245
- id: create_id(feature[:name]),
246
+ id: create_id(feature.name),
246
247
  uri: uri,
247
- keyword: feature[:keyword],
248
- name: feature[:name],
249
- description: value_or_empty_string(feature[:description]),
250
- line: feature[:location][:line]
248
+ keyword: feature.keyword,
249
+ name: feature.name,
250
+ description: value_or_empty_string(feature.description),
251
+ line: feature.location.line
251
252
  }
252
- return if feature[:tags].empty?
253
- @feature_hash[:tags] = create_tags_array_from_hash_array(feature[:tags])
253
+ return if feature.tags.empty?
254
+ @feature_hash[:tags] = create_tags_array_from_hash_array(feature.tags)
254
255
  end
255
256
 
256
257
  def background(background)
257
258
  @background_hash = {
258
- keyword: background[:keyword],
259
- name: background[:name],
260
- description: value_or_empty_string(background[:description]),
261
- line: background[:location][:line],
259
+ keyword: background.keyword,
260
+ name: background.name,
261
+ description: value_or_empty_string(background.description),
262
+ line: background.location.line,
262
263
  type: 'background'
263
264
  }
264
265
  end
@@ -267,9 +268,9 @@ module Cucumber
267
268
  scenario = scenario_source.type == :Scenario ? scenario_source.scenario : scenario_source.scenario_outline
268
269
  @test_case_hash = {
269
270
  id: "#{@feature_hash[:id]};#{create_id_from_scenario_source(scenario_source)}",
270
- keyword: scenario[:keyword],
271
- name: scenario[:name],
272
- description: value_or_empty_string(scenario[:description]),
271
+ keyword: scenario.keyword,
272
+ name: test_case.name,
273
+ description: value_or_empty_string(scenario.description),
273
274
  line: test_case.location.lines.max,
274
275
  type: 'scenario'
275
276
  }
@@ -288,24 +289,24 @@ module Cucumber
288
289
 
289
290
  def create_id_from_scenario_source(scenario_source)
290
291
  if scenario_source.type == :Scenario
291
- create_id(scenario_source.scenario[:name])
292
+ create_id(scenario_source.scenario.name)
292
293
  else
293
- scenario_outline_name = scenario_source.scenario_outline[:name]
294
- examples_name = scenario_source.examples[:name]
294
+ scenario_outline_name = scenario_source.scenario_outline.name
295
+ examples_name = scenario_source.examples.name
295
296
  row_number = calculate_row_number(scenario_source)
296
297
  "#{create_id(scenario_outline_name)};#{create_id(examples_name)};#{row_number}"
297
298
  end
298
299
  end
299
300
 
300
301
  def calculate_row_number(scenario_source)
301
- scenario_source.examples[:table_body].each_with_index do |row, index|
302
+ scenario_source.examples.table_body.each_with_index do |row, index|
302
303
  return index + 2 if row == scenario_source.row
303
304
  end
304
305
  end
305
306
 
306
307
  def create_tags_array_from_hash_array(tags)
307
308
  tags_array = []
308
- tags.each { |tag| tags_array << { name: tag[:name], line: tag[:location][:line] } }
309
+ tags.each { |tag| tags_array << { name: tag.name, line: tag.location.line } }
309
310
  tags_array
310
311
  end
311
312
 
@@ -82,8 +82,8 @@ module Cucumber
82
82
 
83
83
  def start_feature(test_case)
84
84
  uri = test_case.location.file
85
- feature = @ast_lookup.gherkin_document(uri)[:feature]
86
- raise UnNamedFeatureError, uri if feature[:name].empty?
85
+ feature = @ast_lookup.gherkin_document(uri).feature
86
+ raise UnNamedFeatureError, uri if feature.name.empty?
87
87
  @current_feature_data = @features_data[uri]
88
88
  @current_feature_data[:uri] = uri unless @current_feature_data[:uri]
89
89
  @current_feature_data[:feature] = feature unless @current_feature_data[:feature]
@@ -97,8 +97,8 @@ module Cucumber
97
97
  errors: feature_data[:errors],
98
98
  skipped: feature_data[:skipped],
99
99
  tests: feature_data[:tests],
100
- time: format('%.6f', feature_data[:time]),
101
- name: feature_data[:feature][:name]
100
+ time: format('%<time>.6f', time: feature_data[:time]),
101
+ name: feature_data[:feature].name
102
102
  ) do
103
103
  @testsuite << feature_data[:builder].target!
104
104
  end
@@ -108,7 +108,7 @@ module Cucumber
108
108
 
109
109
  def create_output_string(test_case, scenario, result, row_name) # rubocop:disable Metrics/PerceivedComplexity
110
110
  scenario_source = @ast_lookup.scenario_source(test_case)
111
- keyword = scenario_source.type == :Scenario ? scenario_source.scenario[:keyword] : scenario_source.scenario_outline[:keyword]
111
+ keyword = scenario_source.type == :Scenario ? scenario_source.scenario.keyword : scenario_source.scenario_outline.keyword
112
112
  output = "#{keyword}: #{scenario}\n\n"
113
113
  return output if result.ok?(@config.strict)
114
114
  if scenario_source.type == :Scenario
@@ -117,7 +117,7 @@ module Cucumber
117
117
  output += "#{@failing_test_step.text} at #{@failing_test_step.location}\n"
118
118
  else
119
119
  step_source = @ast_lookup.step_source(@failing_test_step).step
120
- output += "#{step_source[:keyword]}#{@failing_test_step.text}\n"
120
+ output += "#{step_source.keyword}#{@failing_test_step.text}\n"
121
121
  end
122
122
  else # An Around hook has failed
123
123
  output += "Around hook\n"
@@ -131,10 +131,10 @@ module Cucumber
131
131
  def build_testcase(result, scenario_designation, output)
132
132
  duration = ResultBuilder.new(result).test_case_duration
133
133
  @current_feature_data[:time] += duration
134
- classname = @current_feature_data[:feature][:name]
134
+ classname = @current_feature_data[:feature].name
135
135
  name = scenario_designation
136
136
 
137
- @current_feature_data[:builder].testcase(classname: classname, name: name, time: format('%.6f', duration)) do
137
+ @current_feature_data[:builder].testcase(classname: classname, name: name, time: format('%<duration>.6f', duration: duration)) do
138
138
  if !result.passed? && result.ok?(@config.strict)
139
139
  @current_feature_data[:builder].skipped
140
140
  @current_feature_data[:skipped] += 1
@@ -203,15 +203,15 @@ module Cucumber
203
203
  end
204
204
 
205
205
  def scenario(scenario)
206
- @scenario_name = scenario[:name].empty? ? 'Unnamed scenario' : scenario[:name]
206
+ @scenario_name = scenario.name.empty? ? 'Unnamed scenario' : scenario.name
207
207
  end
208
208
 
209
209
  def scenario_outline(outline)
210
- @scenario_name = outline[:name].empty? ? 'Unnamed scenario outline' : outline[:name]
210
+ @scenario_name = outline.name.empty? ? 'Unnamed scenario outline' : outline.name
211
211
  end
212
212
 
213
213
  def examples_table_row(row)
214
- @row_name = '| ' + row[:cells].map { |cell| cell[:value] }.join(' | ') + ' |'
214
+ @row_name = '| ' + row.cells.map(&:value).join(' | ') + ' |'
215
215
  @name_suffix = " (outline example : #{@row_name})"
216
216
  end
217
217
  end
@@ -238,6 +238,8 @@ module Cucumber
238
238
  def duration(duration, *)
239
239
  duration.tap { |dur| @test_case_duration = dur.nanoseconds / 10**9.0 }
240
240
  end
241
+
242
+ def embed(*) end
241
243
  end
242
244
  end
243
245
  end
@@ -19,7 +19,7 @@ module Cucumber
19
19
  #
20
20
  # If the output is STDOUT (and not a file), there are bright colours to watch too.
21
21
  #
22
- class Pretty
22
+ class Pretty # rubocop:disable Metrics/ClassLength
23
23
  include FileUtils
24
24
  include Console
25
25
  include Io
@@ -101,13 +101,11 @@ module Cucumber
101
101
  print_step_header(current_test_case) if first_step_after_printing_background_steps?(event.test_step)
102
102
  end
103
103
 
104
- def on_test_step_finished(event) # rubocop:disable Metrics/PerceivedComplexity
104
+ def on_test_step_finished(event)
105
105
  collect_snippet_data(event.test_step, @ast_lookup) if event.result.undefined?
106
106
  return if in_scenario_outline && !options[:expand]
107
107
  exception_to_be_printed = find_exception_to_be_printed(event.result)
108
- # rubocop:disable Metrics/LineLength
109
- print_step_data(event.test_step, event.result) if !event.test_step.hook? && (print_background_steps || event.test_step.location.lines.max >= current_test_case.location.lines.max || exception_to_be_printed)
110
- # rubocop:enable Metrics/LineLength
108
+ print_step_data(event.test_step, event.result) if print_step_data?(event, exception_to_be_printed)
111
109
  print_step_output
112
110
  return unless exception_to_be_printed
113
111
  print_exception(exception_to_be_printed, event.result.to_sym, 6)
@@ -155,10 +153,10 @@ module Cucumber
155
153
  end
156
154
 
157
155
  def calculate_source_indent_for_ast_node(ast_node)
158
- indent = 4 + ast_node[:keyword].length
159
- indent += 1 + ast_node[:name].length
160
- ast_node[:steps].each do |step|
161
- step_indent = 5 + step[:keyword].length + step[:text].length
156
+ indent = 4 + ast_node.keyword.length
157
+ indent += 1 + ast_node.name.length
158
+ ast_node.steps.each do |step|
159
+ step_indent = 5 + step.keyword.length + step.text.length
162
160
  indent = step_indent if step_indent > indent
163
161
  end
164
162
  indent
@@ -190,9 +188,9 @@ module Cucumber
190
188
  end
191
189
 
192
190
  def feature_has_background?
193
- feature_children = gherkin_document[:feature][:children]
191
+ feature_children = gherkin_document.feature.children
194
192
  return false if feature_children.empty?
195
- !feature_children.first[:background].nil?
193
+ !feature_children.first.background.nil?
196
194
  end
197
195
 
198
196
  def print_step_header(test_case)
@@ -240,12 +238,12 @@ module Cucumber
240
238
  end
241
239
 
242
240
  def print_feature_data
243
- feature = gherkin_document[:feature]
244
- print_language_comment(feature[:location][:line])
245
- print_comments(feature[:location][:line], 0)
246
- print_tags(feature[:tags], 0)
241
+ feature = gherkin_document.feature
242
+ print_language_comment(feature.location.line)
243
+ print_comments(feature.location.line, 0)
244
+ print_tags(feature.tags, 0)
247
245
  print_feature_line(feature)
248
- print_description(feature[:description])
246
+ print_description(feature.description)
249
247
  @io.flush
250
248
  end
251
249
 
@@ -256,11 +254,11 @@ module Cucumber
256
254
  end
257
255
 
258
256
  def print_comments(up_to_line, indent)
259
- comments = gherkin_document[:comments]
257
+ comments = gherkin_document.comments
260
258
  return if comments.empty? || comments.length <= @next_comment_to_be_printed
261
259
  comments[@next_comment_to_be_printed..-1].each do |comment|
262
- if comment[:location][:line] <= up_to_line
263
- @io.puts(format_string(comment[:text].strip, :comment).indent(indent))
260
+ if comment.location.line <= up_to_line
261
+ @io.puts(format_string(comment.text.strip, :comment).indent(indent))
264
262
  @next_comment_to_be_printed += 1
265
263
  end
266
264
  break if @next_comment_to_be_printed >= comments.length
@@ -269,11 +267,11 @@ module Cucumber
269
267
 
270
268
  def print_tags(tags, indent)
271
269
  return if !tags || tags.empty?
272
- @io.puts(tags.map { |tag| format_string(tag[:name], :tag) }.join(' ').indent(indent))
270
+ @io.puts(tags.map { |tag| format_string(tag.name, :tag) }.join(' ').indent(indent))
273
271
  end
274
272
 
275
273
  def print_feature_line(feature)
276
- print_keyword_name(feature[:keyword], feature[:name], 0)
274
+ print_keyword_name(feature.keyword, feature.name, 0)
277
275
  end
278
276
 
279
277
  def print_keyword_name(keyword, name, indent, location = nil)
@@ -296,29 +294,37 @@ module Cucumber
296
294
 
297
295
  def print_background_data
298
296
  @io.puts
299
- background = gherkin_document[:feature][:children].first[:background]
297
+ background = gherkin_document.feature.children.first.background
300
298
  @source_indent = calculate_source_indent_for_ast_node(background) if options[:source]
301
- print_comments(background[:location][:line], 2)
299
+ print_comments(background.location.line, 2)
302
300
  print_background_line(background)
303
- print_description(background[:description])
301
+ print_description(background.description)
304
302
  @io.flush
305
303
  end
306
304
 
307
305
  def print_background_line(background)
308
- print_keyword_name(background[:keyword], background[:name], 2, "#{current_feature_uri}:#{background[:location][:line]}")
306
+ print_keyword_name(background.keyword, background.name, 2, "#{current_feature_uri}:#{background.location.line}")
309
307
  end
310
308
 
311
309
  def print_scenario_data(test_case)
312
310
  scenario = scenario_source(test_case).scenario
313
- print_comments(scenario[:location][:line], 2)
314
- print_tags(scenario[:tags], 2)
311
+ print_comments(scenario.location.line, 2)
312
+ print_tags(scenario.tags, 2)
315
313
  print_scenario_line(scenario, test_case.location)
316
- print_description(scenario[:description])
314
+ print_description(scenario.description)
317
315
  @io.flush
318
316
  end
319
317
 
320
318
  def print_scenario_line(scenario, location = nil)
321
- print_keyword_name(scenario[:keyword], scenario[:name], 2, location)
319
+ print_keyword_name(scenario.keyword, scenario.name, 2, location)
320
+ end
321
+
322
+ def print_step_data?(event, exception_to_be_printed)
323
+ !event.test_step.hook? && (
324
+ print_background_steps ||
325
+ event.test_step.location.lines.max >= current_test_case.location.lines.max ||
326
+ exception_to_be_printed
327
+ )
322
328
  end
323
329
 
324
330
  def print_step_data(test_step, result)
@@ -334,7 +340,7 @@ module Cucumber
334
340
 
335
341
  def test_step_keyword(test_step)
336
342
  step = step_source(test_step).step
337
- step[:keyword]
343
+ step.keyword
338
344
  end
339
345
 
340
346
  def step_source(test_step)
@@ -355,38 +361,38 @@ module Cucumber
355
361
 
356
362
  def print_multiline_argument(test_step, result, indent)
357
363
  step = step_source(test_step).step
358
- if !step[:doc_string].nil?
359
- print_doc_string(step[:doc_string][:content], result.to_sym, indent)
360
- elsif !step[:data_table].nil?
361
- print_data_table(step[:data_table], result.to_sym, indent)
364
+ if !step.doc_string.nil?
365
+ print_doc_string(step.doc_string.content, result.to_sym, indent)
366
+ elsif !step.data_table.nil?
367
+ print_data_table(step.data_table, result.to_sym, indent)
362
368
  end
363
369
  end
364
370
 
365
371
  def print_data_table(data_table, status, indent)
366
- data_table[:rows].each do |row|
367
- print_comments(row[:location][:line], indent)
368
- @io.puts format_string(gherkin_source.split("\n")[row[:location][:line] - 1].strip, status).indent(indent)
372
+ data_table.rows.each do |row|
373
+ print_comments(row.location.line, indent)
374
+ @io.puts format_string(gherkin_source.split("\n")[row.location.line - 1].strip, status).indent(indent)
369
375
  end
370
376
  end
371
377
 
372
378
  def print_outline_data(scenario_outline) # rubocop:disable Metrics/AbcSize
373
- print_comments(scenario_outline[:location][:line], 2)
374
- print_tags(scenario_outline[:tags], 2)
379
+ print_comments(scenario_outline.location.line, 2)
380
+ print_tags(scenario_outline.tags, 2)
375
381
  @source_indent = calculate_source_indent_for_ast_node(scenario_outline) if options[:source]
376
- print_scenario_line(scenario_outline, "#{current_feature_uri}:#{scenario_outline[:location][:line]}")
377
- print_description(scenario_outline[:description])
378
- scenario_outline[:steps].each do |step|
379
- print_comments(step[:location][:line], 4)
380
- step_line = " #{step[:keyword]}#{step[:text]}"
382
+ print_scenario_line(scenario_outline, "#{current_feature_uri}:#{scenario_outline.location.line}")
383
+ print_description(scenario_outline.description)
384
+ scenario_outline.steps.each do |step|
385
+ print_comments(step.location.line, 4)
386
+ step_line = " #{step.keyword}#{step.text}"
381
387
  @io.print(format_string(step_line, :skipped))
382
388
  if options[:source]
383
- comment_line = format_string("# #{current_feature_uri}:#{step[:location][:line]}", :comment)
389
+ comment_line = format_string("# #{current_feature_uri}:#{step.location.line}", :comment)
384
390
  @io.print(comment_line.indent(@source_indent - step_line.length))
385
391
  end
386
392
  @io.puts
387
393
  next if options[:no_multiline]
388
- print_doc_string(step[:doc_string][:content], :skipped, 6) unless step[:doc_string].nil?
389
- print_data_table(step[:data_table], :skipped, 6) unless step[:data_table].nil?
394
+ print_doc_string(step.doc_string.content, :skipped, 6) unless step.doc_string.nil?
395
+ print_data_table(step.data_table, :skipped, 6) unless step.data_table.nil?
390
396
  end
391
397
  @io.flush
392
398
  end
@@ -398,13 +404,13 @@ module Cucumber
398
404
  end
399
405
 
400
406
  def print_examples_data(examples)
401
- print_comments(examples[:location][:line], 4)
402
- print_tags(examples[:tags], 4)
403
- print_keyword_name(examples[:keyword], examples[:name], 4)
404
- print_description(examples[:description])
407
+ print_comments(examples.location.line, 4)
408
+ print_tags(examples.tags, 4)
409
+ print_keyword_name(examples.keyword, examples.name, 4)
410
+ print_description(examples.description)
405
411
  unless options[:expand]
406
- print_comments(examples[:table_header][:location][:line], 6)
407
- @io.puts(gherkin_source.split("\n")[examples[:table_header][:location][:line] - 1].strip.indent(6))
412
+ print_comments(examples.table_header.location.line, 6)
413
+ @io.puts(gherkin_source.split("\n")[examples.table_header.location.line - 1].strip.indent(6))
408
414
  end
409
415
  @io.flush
410
416
  end
@@ -427,12 +433,12 @@ module Cucumber
427
433
  end
428
434
 
429
435
  def print_expanded_row_data(test_case)
430
- feature = gherkin_document[:feature]
431
- language_code = feature[:language] || 'en'
436
+ feature = gherkin_document.feature
437
+ language_code = feature.language || 'en'
432
438
  language = ::Gherkin::Dialect.for(language_code)
433
439
  scenario_keyword = language.scenario_keywords[0]
434
440
  row = scenario_source(test_case).row
435
- expanded_name = '| ' + row[:cells].map { |cell| cell[:value] }.join(' | ') + ' |'
441
+ expanded_name = '| ' + row.cells.map(&:value).join(' | ') + ' |'
436
442
  @source_indent = calculate_source_indent_for_expanded_test_case(test_case, scenario_keyword, expanded_name)
437
443
  @io.puts
438
444
  print_keyword_name(scenario_keyword, expanded_name, 6, test_case.location)