Trying to pass some arguments to rspec
, but coulnd't find any proper command-line options for the purpose. I could use environment variable for that, but not sure it is the best (and most transparent) way to configure the tests.
So, how can I pass the command-line arguments? If can't - which is the best and most acceptable alternative?
One clean way to do this is to add tags for your options, though this might not work in your case.
rspec --tag sleep_5_seconds
And then in your spec_helper.rb
RSpec.configure do |c|
before(:each, :sleep_5_seconds => true) do
setup_5_second_sleep
end
end
This code hasn't been run, but that's the concept. You could also do it with an around block if you need to setup and teardown based on the variable.
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