Monday, January 6, 2014

Divide spec into slow and fast tests

Some tests are too slow to run each time. In Rspec you can do this. Add on the top of the spec.rb file the following command:
RSpec.configure do |c|
  c.filter_run_excluding :slow => true
end
Now you tag the slow tests:
describe "add a user", slow: :true do
Next time you run "rspec spec" the slow tests will not run

No DRb server is running. Running in local process instead ...
Run options: exclude {:slow=>true}
...............................................
If you want to run the slow tests, use a flag:
rspec spec --tag slow
and now they run

No DRb server is running. Running in local process instead ...
Run options: include {:slow=>true}
...................

No comments:

Post a Comment