LoginSignup
4
4

More than 5 years have passed since last update.

Rails 5に移行した後にTravis CIのbundle exec rakeでエラーが出たら対処する方法

Posted at

対象のエラー

Rails 5に移行した後にTravis CIのbundle exec rakeでエラーでこんなのが出たら...

/home/travis/build/yamamuteki/chi-bus.jp/vendor/bundle/ruby/2.2.0/gems/activerecord-5.0.0/lib/active_record/migration.rb:572:in `check_pending!':  (ActiveRecord::PendingMigrationError)

Migrations are pending. To resolve this issue, run:

    bin/rails db:migrate RAILS_ENV=test

対応方法

script:セクションを作ってbin/rails db:migrate RAILS_ENV=testbin/rails testを追加する

.travis.yml
language: ruby
rvm:
  - 2.2.4
# ここから
script:
  - bin/rails db:migrate RAILS_ENV=test
  - bin/rails test
# ここまでを追加

結論

Raila 4.2ではrakeタスクが自動でやってくれていたので不便

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4