cucumber-ruby: cucumber-expressions wrong number of arguments (given 0, expected 1)
Summary
Just upgraded:
cucumber (3.0.2 → 3.1.0) cucumber-core (3.0.0 → 3.1.0) cucumber-expressions (4.0.4 → 5.0.17) cucumber-tag_expressions (1.0.1 → 1.1.1) gherkin (4.1.3 → 5.0.0) cucumber-rails (1.5.0 → 1.6.0)
and now I’m getting a wrong number of arguments (given 0, expected 1) (ArgumentError) in cucumber-expressions.
Expected Behavior
There should be no ArgumentError.
Current Behavior
When running my tests, I get an ArgumentError in cucumber-expressions-5.0.17/lib/cucumber/cucumber_expressions/parameter_type_registry.rb:17:in block in initialize’`.
Stacktrace:
cucumber-expressions-5.0.17/lib/cucumber/cucumber_expressions/parameter_type_registry.rb:17:in `block in initialize'
cucumber-expressions-5.0.17/lib/cucumber/cucumber_expressions/parameter_type.rb:38:in `instance_exec'
cucumber-expressions-5.0.17/lib/cucumber/cucumber_expressions/parameter_type.rb:38:in `transform'
cucumber-expressions-5.0.17/lib/cucumber/cucumber_expressions/argument.rb:33:in `value'
cucumber-3.1.0/lib/cucumber/step_match.rb:18:in `block in args'
cucumber-3.1.0/lib/cucumber/step_match.rb:17:in `map'
cucumber-3.1.0/lib/cucumber/step_match.rb:17:in `args'
cucumber-3.1.0/lib/cucumber/step_match.rb:97:in `deep_clone_args'
cucumber-3.1.0/lib/cucumber/step_match.rb:29:in `invoke'
cucumber-3.1.0/lib/cucumber/step_match.rb:24:in `block in activate'
...
Possible Solution
The line causing the error looks like this:
define_parameter_type(ParameterType.new('int', INTEGER_REGEXPS, Integer, lambda {|s| s.to_i}, true, true))
The error comes from the arity of the lambda being one, but it’s called in paramter_type.rb:38 with no args: self_obj.instance_exec(*group_values, &@transformer) (@transformer is the lambda from above).
I have no idea what’s going on there, but there’s already another commit fixing the arity of other lambdas. Could this be connected?
Steps to Reproduce (for bugs)
- upgrade cucumber-expressions to 5.0.17
- run tests
Sorry this is happening in a closed source repo. I can try to create a small test repo to expose the problem, but maybe it’s a quick fix for someone who knows more about the code base.
Context & Motivation
Tests are broken.
Your Environment
- Version used: cucumber-expressions 5.0.17, Ruby 2.3.6
- Operating System and version: MacOS 10.13.4
- Link to your project: -
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 22 (11 by maintainers)
I say this is fixed and can be closed.
Yes please
with
gem 'cucumber', git: 'git://github.com/cucumber/cucumber-ruby.git'(including cucumber-expressions 5.0.17) everything is green 👍Possibly related issue https://github.com/cucumber/cucumber/issues/375 - does it work with expressions 5.0.15?