Skip to content

Commit

Permalink
Avoid negative Cucumber::Ast::HasSteps#source_indent (#926)
Browse files Browse the repository at this point in the history
Some monkey patched implementations of `String#indent`, such as Active
Support's, do not handle negative values (see issue #620). This behavior
isn't strictly a bug in Cucumber but a lower bound of 0 in
`#source_indent` would mitigate the occurrences of related errors.
  • Loading branch information
marxarelli authored and mattwynne committed Apr 19, 2016
1 parent 2b19d9f commit 20fa462
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cucumber/ast/has_steps.rb
Expand Up @@ -46,7 +46,7 @@ def backtrace_line(step_name = "#{@keyword}: #{name}", line = self.line)
end

def source_indent(text_length)
max_line_length - text_length
[max_line_length - text_length, 0].max
end

def max_line_length
Expand Down

0 comments on commit 20fa462

Please sign in to comment.