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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With