You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Included NullDB but when running RSpec still got ActiveRecord::ConnectionNotEstablished #121
group :test do
gem 'activerecord-nulldb-adapter'
end
In one of my spec.rb file, I alr included
require 'nulldb_rspec'
require './spec/support/null_db.rb'
describe DemandPrediction::Jobs::DailyItemPopulator, type: :job do
include NullDB::RSpec::NullifiedDatabase
before do
allow_any_instance_of(DemandPrediction::Models::Item).to receive(:last).and_return(nil)
allow_any_instance_of(DemandPrediction::Models::Item).to receive(:import)
end
context 'xxx' do
end
end
But when I run the rspec
I still got the following err
ActiveRecord::ConnectionNotEstablished: connection to server on socket "/tmp/.s.PGSQL.5432" failed
Activity
cabello commentedon Oct 16, 2023
From the error it appears that your code is still attempting to connect to the real Postgres database.