Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSpec > Is there a way to run all tests with one command?

Is there a command that does this? I've searched but can not find anything

like image 363
ahmet Avatar asked Aug 26 '11 11:08

ahmet


People also ask

How do I run a specific test case in RSpec?

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.

How do I run a RSpec test in terminal?

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.

What does bundle exec RSpec do?

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 .


2 Answers

Try this in your terminal window:

bundle exec rspec spec 
like image 74
Waseem Avatar answered Sep 25 '22 20:09

Waseem


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

like image 20
arunagw Avatar answered Sep 22 '22 20:09

arunagw