Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Using @leshill solution for building the message

  • Loading branch information...
commit 862022b5c94bdce1b9da9d4914c019bea95c54d1 1 parent a5463f3
@rchampourlier rchampourlier authored
Showing with 3 additions and 6 deletions.
  1. +3 −6 lib/turnip/execute.rb
View
9 lib/turnip/execute.rb
@@ -2,18 +2,15 @@ module Turnip
module Execute
def step(description, *extra_args)
extra_args.concat(description.extra_args) if description.respond_to?(:extra_args)
-
matches = methods.map do |method|
next unless method.to_s.start_with?("match: ")
send(method.to_s, description.to_s)
end.compact
raise Turnip::Pending, description if matches.length == 0
if matches.length > 1
- msg = "Ambiguous step definitions:\r\n"
- matches.each_with_index do |match, index|
- # prepare an error message with some information on the ambiguous steps
- msg += " #{index+1}. \"#{match.expression}\" (#{match.block.source_location.join(':')})\r\n"
- end
+ msg = (matches.map do |match|
+ " - \"#{match.expression}\" (#{match.block.source_location.join(':')})"
+ end.unshift('Ambiguous step definitions').join("\r\n"))
raise Turnip::Ambiguous, msg
end
send(matches.first.expression, *(matches.first.params + extra_args))
Please sign in to comment.
Something went wrong with that request. Please try again.