After upgrading a Rails app to Rails 5, running RSpec tests gives me the following error:
rails aborted!
ActiveRecord::NoEnvironmentInSchemaError:
Environm
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