From 1dfe9940a1abc0a4fe034262a38b15c26178e1f2 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Wed, 27 Sep 2017 21:53:55 +0200 Subject: [PATCH] Legacy API adapter: Use node.to_s --- lib/cucumber/formatter/legacy_api/adapter.rb | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/cucumber/formatter/legacy_api/adapter.rb b/lib/cucumber/formatter/legacy_api/adapter.rb index 08347dec8a..5c3460b23c 100644 --- a/lib/cucumber/formatter/legacy_api/adapter.rb +++ b/lib/cucumber/formatter/legacy_api/adapter.rb @@ -920,7 +920,7 @@ def initialize(node) [:step, :outline_step].each do |node_name| define_method(node_name) do |node| - record_width_of_step node + record_width_of node end end @@ -930,20 +930,11 @@ def examples_table_row(*); end def of(node) # The length of the instantiated steps in --expand mode are currently # not included in the calculation of max => make sure to return >= 1 - if node.respond_to?(:name) - [1, max - node.name.length - node.keyword.length].max - else - [1, max - node.text.length - node.keyword.length].max - end - + [1, max - node.to_s.length - node.keyword.length].max end def record_width_of(node) - @widths << node.keyword.length + node.name.length + 1 - end - - def record_width_of_step(node) - @widths << node.keyword.length + node.text.length + 1 + @widths << node.keyword.length + node.to_s.length + 1 end private