Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rake spec:models VS rspec spec/models which is recommended

We figured out both commands

rake spec:models

and

rspec spec/models

behave slightly differently in the way that the rake task cleans up the database first. Our tests relies on some initial data (from db/seeds.rb) so rake spec:models fails.

In the meantime I'm pretty sure one of these commands will get deprecated on day or another.

Which one should we trust?

like image 496
demental Avatar asked Jul 19 '11 15:07

demental


1 Answers

Neither will be deprecated, but you are correct that you're on your own to run rake db:test:prepare before you run rspec spec/models. Assuming you have a standard default configuration, you should only have to do that once.

The drawback of rake spec:models is that it loads the Rails environment twice: once in development mode, and once in test mode.

like image 171
David Chelimsky Avatar answered Oct 06 '22 00:10

David Chelimsky