After upgrading a Rails app to Rails 5, running RSpec tests gives me the following error:
rails aborted!
ActiveRecord::NoEnvironmentInSchemaError:
Environment data not found in the schema. To resolve this issue, run:
bin/rails db:environment:set RAILS_ENV=test
However, that bin
does not exist and I can't seem to generate it with bundle binstubs rails
or with rake rails:update:bin
.
I have also tried:
rails db:environment:set RAILS_ENV=test
rake db:environment:set RAILS_ENV=test
There is a related issue on Github here.
How can I address this error?
env RAILS_ENV={{whatever}} bin/rake db:migrate spec
used to work just fine – Raucous