In my Rails 4 app, I'm using Rspec for testing. My directory structure is
spec
-- controllers
-- factories
-- features
-- spec_helper.rb
-- support
When I run rspec spec
, it runs my tests in controllers
, but not in features
. I can specify rspec spec/features
and they'll run, but I want to be able to run all tests under spec
at once. My guess is it's not looking in features
because of a configuration setting, but I don't know where this is.
I've tried different incantations of starting rspec but haven't had any luck.
To run a single Rspec test file, you can do: rspec spec/models/your_spec. rb to run the tests in the your_spec. rb file.
Feature specs, a kind of acceptance test, are high-level tests that walk through your entire application ensuring that each of the components work together. They're written from the perspective of a user clicking around the application and filling in forms.
Boot up your terminal and punch in gem install rspec to install RSpec. Once that's done, you can verify your version of RSpec with rspec --version , which will output the current version of each of the packaged gems. Take a minute also to hit rspec --help and look through the various options available. That's it.
Based on your feedback to the comments above, the issue is one of file naming. I've definitely been burned by that before too. By default Rspec will go through the files looking for ones ending with _spec.rb
, this default behaviour is overridden if you specify the folder manually.
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