[rspec-users] How to separate unit and integration spec suites?

Myron Marston myron.marston at gmail.com
Wed May 19 17:11:21 EDT 2010

On my current rails project we're using both rspec and cucumber.
We've been diligent about keeping our specs as true unit tests, using
nulldb and mocking/stubbing to disconnect the specs from the database
and keep each spec focused on the class/method under test.  Our
cucumber features are integration tests and use the database (as they
should).  This separation has worked well for us up to now.  Our specs
have remained fairly fast, even as our spec suite has grown (around
1200 specs, currently).

I've started working on building an REST-inspired HTTP API for the
app.  Initially, I've continued to use cucumber to integration test
the API.  However, I'm now convinced that as great as cucumber is for
integration testing the user-facing parts of our application, it's not
the right tool for integration testing the API.  I'd like to write my
API integration tests using just rspec and rack-test.  But I really
like the fact that "rake spec" runs only the unit tests, and is much
faster than running all of the tests.  I don't want to give that up.

Is there an easy way to setup multiple spec suites within a single
rails app?  I'd like to run the integration test specs separately from
the unit test specs.


More information about the rspec-users mailing list