Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
4
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

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

対象のエラー

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タスクが自動でやってくれていたので不便

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
4
Help us understand the problem. What are the problem?