Rails 5, Rspec: Environment data not found in the schema

前端 未结 7 1127
南方客
南方客 2020-12-29 01:49

After upgrading a Rails app to Rails 5, running RSpec tests gives me the following error:

rails aborted!
ActiveRecord::NoEnvironmentInSchemaError: 

Environm         


        
相关标签:
7条回答
  • 2020-12-29 02:50

    I had to drop my database for tests and create it again:

    1. psql
    2. DROP DATABASE your_db_name_test;
    3. bundle exec rake db:create RAILS_ENV=test

    After that the warning bin/rails db:environment:set RAILS_ENV=test disappeared.

    0 讨论(0)
提交回复
热议问题