[rspec-users] Problem running RSpec tests with Rails

David Chelimsky dchelimsky at gmail.com
Tue Jul 27 06:37:57 EDT 2010


On Jul 27, 2010, at 4:10 AM, Bruno Cardoso wrote:

> David Chelimsky wrote:
>> On Jul 26, 2010, at 12:36 PM, Bruno Cardoso wrote:
>> 
>>> Thanks for the answers.
>>> 
>>> 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?
>> 
>> So is your goal here to have the rake task(s) ignore the fact that you 
>> have pending migrations, but still have it reset the test database so 
>> it's schema looks like the development database schema?
> 
> Exactly.

OK. This is not Rails' intent (which is why 'db:abort_if_pending_migrations' is a prereq of 'db:test:prepare'), but you can use the same technique I described earlier on 'db:test:prepare' instead of 'spec':

  Rake::Task['db:test:prepare'].clear_prerequisites

Now you should get what you're looking for.

Cheers,
David

> 
> I'm ok with the previous solution, it's something we can do but I would 
> like to know what I could do if I wanted to go by my first plan.
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list