I have a Rails 4.2.8 app, ruby 2.4.4 with a Mongo database, using the mongoid ODB.
I want to run tests against this application using rspec. The most basic test gives me this error:
ActiveRecord::ConnectionNotEstablished: No connection pool for ActiveRecord::Base
My research on this problem lead me to these conclusions, but I do not know how to solve the problem itself:
RAILS_ENV=TEST rails console
and I can query documents.Some help would really be appreciated as I do not know what to do next...
Ok so I did not figure out who was loading ActiveRecord in my application, but I manually unload it in my rails_helper.rb
:
Object.send(:remove_const, :ActiveRecord)
# Make sure it is above this
require 'rspec/rails'