リア充爆発日記

You don't even know what ria-ju really is.

Rails4.1にUpgradeしてRspecでMigrations are pendingと言われるようになったら

Rails4.0->Rails4.1にUpgradeしたのち、DBに修正いれてrake test:prepareしてrspec実行したら以下のエラーがでた。

/Users/ria10/IdeaProjects/ria10-web/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.0/lib/active_record/migration.rb:389:in `check_pending!': (ActiveRecord::PendingMigrationError)

Migrations are pending. To resolve this issue, run:

bin/rake db:migrate RAILS_ENV=test

バーローそんなんいちいちやってられるかコノヤローと思って調べた。

結果、spec_helper.rbに以下の修正を入れたら解決した。
https://github.com/rspec/rspec-rails/issues/936

~snip~
# ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration) # remove
ActiveRecord::Migration.maintain_test_schema! # new!
~snip~


以上、よろしくおねがいいたします。