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

前端 未结 7 1225
南方客
南方客 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:35

    For me, I had to do a mixture of things:

    bin/rails db:environment:set RAILS_ENV=test
    bin/rails db:migrate RAILS_ENV=test
    

    This would make things work, and then I had to review my migrations, I was adding a null:false into a relationship and that added a bug, the migration was cancelled and didn't finish

提交回复
热议问题