4

I'm using Rails 4.1.4. Whenever I run new migrations, my tests fail, because the migration is apparently not applied to the test database. In the past, I had to run the db:test:prepare rake task, but that now says it's deprecated (though it still works).

My question is, what do I have to do, so the test schema is maintained automatically, as the deprecation message now falsely claims?

Some additional info that might be relevant:

  • I started developing my app on Rails 3.x, then upgraded to 4.x. Maybe this problem does not occur in clean 4.x installs?
  • I'm using the :sql schema format (config.active_record.schema_format = :sql), because I need some db features not supported by the :ruby format. Maybe the automatic test migrations work only with the :ruby format?
adam
  • 791
  • 6
  • 21
  • possible duplicate of [When I ran \`bundle exec rake test:prepare\` it errored out, but \`bundle exec rake db:test:prepare\` goes through fine with warning. What's going on?](http://stackoverflow.com/questions/23351783/when-i-ran-bundle-exec-rake-testprepare-it-errored-out-but-bundle-exec-rake) – Dave Schweisguth Sep 10 '14 at 03:32
  • @DaveSchweisguth: It is not duplicate, I'm asking different thing. The answer over there, however, seems to be helpful for me too. – adam Sep 10 '14 at 17:53
  • Yeah, sometimes I just mean that the answer is the same. – Dave Schweisguth Sep 10 '14 at 21:31

2 Answers2

1

Use this:

rake test:prepare

Hope this helps!

0

What about

RAILS_ENV=test rake db:migrate
asdacap
  • 738
  • 2
  • 9
  • 15