-
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
π What did you see?
When I print the type of 1 # features/test.feature:3
Ambiguous match of "I print the type of 1":
steps/scripting_steps.rb:1:in `nil'
steps/scripting_steps.rb:5:in `nil'
You can run again with --guess to make Cucumber be more smart about it
(Cucumber::Ambiguous)
features/test.feature:3:in `I print the type of 1'
β What did you expect to see?
Because there is no decimal point on the number provided, Cucumber should use the {int} step definition.
Scenario: Demonstrate that floats and ints are not handled as documented # features/test.feature:2
1 is an int
When I print the type of 1 # steps/scripting_steps.rb:1
π¦ Which tool/library version are you using?
ruby-cucumber v10.0 (earlier versions also behave the same).
Ruby v3.2.3 (and others)
π¬ How could we reproduce it?
gem install cucumber
- Contents of features/test.feature:
Feature: Ambiguous parameter
Scenario: Demonstrate that floats and int params are not handled as documented
When I print the type of 1
- Contents of steps/steps.rb:
When('I print the type of {int}') do |number|
puts "#{number} is an int"
end
When('I print the type of {float}') do |number|
puts "#{number} is a float"
end
- Run the command
cucumber -r steps
π Any additional context?
This behaviour seems at odds with the cucumber-expressions documentation:

Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
No status