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

前端 未结 7 1177
南方客
南方客 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

    If you happen to see this error while using parallel_tests gem then you need to run below command for each DB. Just increase TEST_ENV_NUMBER.

    TEST_ENV_NUMBER=1 bin/rails db:environment:set RAILS_ENV=test
    TEST_ENV_NUMBER=2 bin/rails db:environment:set RAILS_ENV=test
    

    This helped me fix the problem when I was testing parallel_tests with knapsack_pro gem https://github.com/KnapsackPro/knapsack_pro-ruby#parallel_tests-with-knapsack_pro-on-single-ci-machine

提交回复
热议问题