I have recently updated the Cucumber gems ('cucumber' and 'cucumber-rails') on my machine and have run into a couple of issues. The one i am currently fighting is that none of the defined steps for my features are being automatically loaded by Cucumber. This results in my command line telling me i "can implement step definitions for undefined steps with these snippets" for every single step i use in my features.
I have run:
cucumber --verbose
...and can see the following:
Code: * vendor/plugins/paperclip/cucumber/paperclip_steps.rb
However, none of the steps are being loaded in by Cucumber unless i specify files to load:
cucumber -r features/step_definitions/web_steps.rb
I thought this might just be the custom step files i had created within the "step_definitions" folder in my app structure but it would appear the standard "web_steps" file isnt being loaded either.
Would appreciate hearing from anyone who has come across this issue or knows why this might be happening.
Thanks.
You can include -r feature into your cucumber.yml file such that cucumber loads all the step definitions in feature/ directory. Append above in std_opts. See appended cucumber.yml file below.
<%
rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip -f feature"
%>
default: <%= std_opts %> features
wip: --tags @wip:3 --wip features
rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
OK i have come up with a solution for this for the time being. Im not sure if its the right one or not. Simple disabling profiles when running the cucumber command seems to ensure that the correct step definitions are loaded for the features.
I can now run my tests with:
cucumber --no-profile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With