Skip to content

Commit

Permalink
Legacy API adapter: Use node.to_s
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed Sep 27, 2017
1 parent a7716c6 commit 1dfe994
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/cucumber/formatter/legacy_api/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 1dfe994

Please sign in to comment.