You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Step definition produced by running bundle exec cucumber on the following scenario produces a syntax error when the code snippets are implemented as a step definition.
Scenario: Listener is within rangeGiven Lucy is located 15 metres from Sean
When Sean shouts "free bagels at Sean's"Then Lucy hears Sean's message
Produces:
# ⋮ Then('Lucy hears Sean'smessage')dopending# Write code here that turns the phrase above into concrete actionsend
…which results in a syntax error due to the unmatched single quote.
What did you expect to see?
# ⋮Then("Lucy hears Sean's message")dopending# Write code here that turns the phrase above into concrete actionsend
…or something similar.
Which tool/library version are you using?
Cucumber v8.0.0.
How could we reproduce it?
Steps to reproduce the behavior:
Install Ruby (I used v2.7.8 from MacPorts) and bundler (I used v2.1.4 from MacPorts)
Create a directory for the example project and cd into it: mkdir shouty && cd shouty
Run bundle config set path vendor/bundle
Run bundle install
Run bundle exec cucumber --init
Create the file features/shout.feature with the following contents
Scenario: Listener is within rangeGiven Lucy is located 15 metres from Sean
When Sean shouts "free bagels at Sean's"Then Lucy hears Sean's message
Run command bundle exec cucumber
Copy-paste the snippet for the step definition into the file features/step_definitions/steps.rb
Given('Lucy is located {int} metres from Sean')do |int|
# Given('Lucy is located {float} metres from Sean') do |float|pending# Write code here that turns the phrase above into concrete actionsendWhen('Sean shouts {string}')do |string|
pending# Write code here that turns the phrase above into concrete actionsendThen('Lucy hears Sean'smessage')dopending# Write code here that turns the phrase above into concrete actionsend
Run bundle exec cucumber again
See the error message:
/path/to/shouty/features/step_definitions/steps.rb10: syntax error, unexpected local variable or method, expecting ')'
Then('Lucy hears Sean's message') do
^
/path/to/shouty/features/step_definitions/steps.rb12: unterminated string meets end of file (SyntaxError)
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb123:in `require'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/glue/registry_and_more.rb123:in `load_code_file'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb145:in `load_file'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb82:in `block in load_files!'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb81:in `each'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/runtime/support_code.rb81:in `load_files!'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb274:in `load_step_definitions'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/runtime.rb74:in `run!'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/lib/cucumber/cli/main.rb29:in `execute!'
/path/to/shouty/vendor/bundle/ruby/2.7.0/gems/cucumber-8.0.0/bin/cucumber9:in `<top (required)>'
/path/to/shouty/vendor/bundle/ruby/2.7.0/bin/cucumber23:in `load'
/path/to/shouty/vendor/bundle/ruby/2.7.0/bin/cucumber23:in `<main>'
What did you see?
Step definition produced by running
bundle exec cucumberon the following scenario produces a syntax error when the code snippets are implemented as a step definition.Produces:
…which results in a syntax error due to the unmatched single quote.
What did you expect to see?
…or something similar.
Which tool/library version are you using?
Cucumber v8.0.0.
How could we reproduce it?
Steps to reproduce the behavior:
Install Ruby (I used v2.7.8 from MacPorts) and bundler (I used v2.1.4 from MacPorts)
Create a directory for the example project and
cdinto it:mkdir shouty && cd shoutyRun
bundle config set path vendor/bundleRun
bundle installRun
bundle exec cucumber --initCreate the file
features/shout.featurewith the following contentsRun command
bundle exec cucumberCopy-paste the snippet for the step definition into the file
features/step_definitions/steps.rbRun
bundle exec cucumberagainSee the error message:
See also