Can I write IO bound RSpec tests more efficiently?

38 Views Asked by At

I am working on a project that focuses on archiving documents. As part of this process we use the Fedora Repository Architecture. While Fedora is a great backend for a repository, writing to Fedora is a slow process and it is causing the run time of our test suite to soar.

When faced with a group of IO bound tests, is there a way to allow other tests to run while waiting for the slow ones to complete in RSpec?

1

There are 1 best solutions below

0
On

One strategy could be to tag you IO bound specs and run the separately. So, you could tag your tests as follows:

describe "MyClass", :io_bound do
  it "is IO intensive" do
    # your tests
  end
end

describe "MyOtherClass" do
  it "is not IO intensive" do
    # your tests
  end
end

Then you run them separately with:

rspec . --tag=io_bound # runs all specs tagged as io bound
rspec . --tag=~io_bound # runs all specs NOT tagged as io bound (all your other tests)