When I run rake spec
it runs all tests. How do I run only the unit tests.
When I run rake spec
it runs all tests. How do I run only the unit tests.
You can specify specific files so that RSpec only runs tests on these files, for example
$ rspec spec/models/*
You will only run the models tests. You can also just run a test by specifying the line, for example.
$ rspec spec/models/user_spec.rb:31
What will only run the test of line 31 of the user_spec.rb file
Rspec tests behavior, while the Unit Test (assuming this tool is used for unit testing) tests the units of your application. You can not run unit tests with a tool that runs behavior tests.
If you want to run only the unit tests you can run the following command:
ruby -I test test/unit/