[rspec-users] Problem running RSpec tests with Rails

David Chelimsky dchelimsky at gmail.com
Mon Jul 26 13:13:44 EDT 2010


On Jul 26, 2010, at 11:50 AM, Ashley Moran wrote:

> 
> On Jul 26, 2010, at 5:12 pm, Bruno Cardoso wrote:
> 
>> Not sure if this is a RSpec problem or Rails but I believe is more a
>> RSpec situation.
>> 
>> What happens is that when I run my RSpecs tests all the BD is recreated,
>> 
>> ...
>> 
>> Anyone know how to resolve this?
> 
> Hi Bruno
> 
> Are you running `rake spec` as opposed to the spec command?  The default Rails spec task depends on the "db:test:prepare" task, which bombs your DB.

The test DB, not the development DB, right? If it's bombing your dev DB then please file a bug report and we can sort it out.

>  I fixed this in my project with a file "lib/tasks/rspec_fixes.rake":
> 
>  class Rake::Task
>    def overwrite(&block)
>      @actions.clear
>      enhance(&block)
>    end
>  end
> 
>  Rake::Task['db:test:prepare'].overwrite do

Another approach would be:

Rake::Task['spec'].prerequisites.clear

Cheers,
David

>    # We don't want to run migrations or load the schema!!!
>  end
> 
> HTH
> 
> Ash
> 
> -- 
> http://www.patchspace.co.uk/
> http://www.linkedin.com/in/ashleymoran
> 
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list