Skip to content

Commit

Permalink
workaround possible nil argument when guessing
Browse files Browse the repository at this point in the history
  • Loading branch information
timfel committed Mar 25, 2010
1 parent de747cf commit fddf58c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/cucumber/step_mother.rb
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ def best_matches(step_name, step_matches) #:nodoc:
longest_regexp_length = no_groups.map {|step_match| step_match.text_length }.max
no_groups.select {|step_match| step_match.text_length == longest_regexp_length }
elsif top_groups.any?
shortest_capture_length = top_groups.map {|step_match| step_match.args.inject(0) {|sum, c| sum + c.length } }.min
top_groups.select {|step_match| step_match.args.inject(0) {|sum, c| sum + c.length } == shortest_capture_length }
shortest_capture_length = top_groups.map {|step_match| step_match.args.inject(0) {|sum, c| sum + c.to_s.length } }.min
top_groups.select {|step_match| step_match.args.inject(0) {|sum, c| sum + c.to_s.length } == shortest_capture_length }
else
top_groups
end
Expand Down

0 comments on commit fddf58c

Please sign in to comment.