Is there a command that does this? I've searched but can not find anything
Running tests by their file or directory names is the most familiar way to run tests with RSpec. RSpec can take a file name or directory name and run the file or the contents of the directory. So you can do: rspec spec/jobs to run the tests found in the jobs directory.
Open your terminal, cd into the project directory, and run rspec spec . The spec is the folder in which rspec will find the tests. You should see output saying something about “uninitialized constant Object::Book”; this just means there's no Book class.
bundle exec changes your $PATH , or %PATH% in case of Windows. As a result, by using bundle exec rspec you're calling the RSpec's version which is specified in your Gemfile . rspec ran without Bundler executes the one in your $PATH .
Try this in your terminal window:
bundle exec rspec spec
if you are using rspec-rails then you can run using rake spec
if you're testing models, use rake spec:models
(or rake spec:routing
or rake spec:controllers
)
if just testing one model, use rake SPEC=app/models/modelname.rb
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