jeudi 17 septembre 2015

For whatever reason, my test database is not "prepared"!

Ok I'm really struggling with this... using Rails 4. Here's what I've done:

  • ensured that my spec_helper is required and it has ActiveRecord::Migration.maintain_test_schema!
  • ran rake db:migrate RAILS_ENV=test
  • even ran rake db:test:prepare though its deprecated

If I spin up a local server, I can see that all the columns I have added are fully ready to use (i.e., can create an object just fine), but my tests keep breaking because all the added columns throw unknown attribute errors.

Some additional context.... I'm trying to rollback my db and start over. When I run a remove_column I get a to_sym error implying that the column doesn't exist... which again is strange since in a local server I can create everything just fine. Whatever. But when I try to add_column I get a column already exists error! What on earth??? How does it think that the column simultaneously is not there and is there? I'm literally using the exact same code for both add/remove, so it's not a fat-finger spelling mess up.

Aucun commentaire:

Enregistrer un commentaire