Perry S. wrote:
I added some db specific constraints. I wanted to test them and tweak
them. So, I have unit tests. But, I was amazed to see all of the pass
the first time.
So, I looked and the test database does not have any constraints. I’m
using PostgreSQL. Is there an option to rake db:test:prepare ?
I’m not sure why this isn’t one tiny bit smoother, but you typically
use lines like
rake RAILS_ENV=test db:migrate
rake RAILS_ENV=test db:test:prepare
rake RAILS_ENV=test db:fixtures:load
You only need to do the first one, once, after adding migrations that
new database details. I don’t think normal development requires the
two. The deal is ‘rake test’ internally switches RAILS_ENV to test mode,
most other rake commands do not.
In extremis (meaning very often) we must ‘drop database’ inside our
(MySquirrel) to then run db:migrate to get a fresh and up-to-date
And props for unit testing!
“Test Driven Ajax (on Rails)”