[rspec-users] Problem running RSpec tests with Rails

Ashley Moran ashley.moran at patchspace.co.uk
Mon Jul 26 17:14:40 EDT 2010

On 26 Jul 2010, at 6:36 PM, Bruno Cardoso wrote:

> What both solutions (from Ashley and David) do is not modify the BD in 
> anyway, so nothing gets dropped and nothing is created. This resolves 
> the problem but what if I want a clean installation in each test run? Is 
> there a way to keep my "schema_migrations" table or remove the check for 
> migration scripts? I would still like to recreate the rest of the 
> tables.

One way is to avoid rake entirely - you could run the specs with `spec spec` or even just use autotest[1].

If you want to just empty the data from the tables you need database_cleaner[2].

If you want the database rebuilt as necessary when migrations change, you could use my database_resetter[3], plug plug :D

Let me know if you're trying to do something other than one of these.  (It's late, I have a habit of talking nonsense when I'm tired...)



[1] eg http://ph7spot.com/musings/getting-started-with-autotest
[2] http://github.com/bmabey/database_cleaner
[3] http://rubygems.org/gems/database_resetter


More information about the rspec-users mailing list