I recently set up a Rails dev environment on a new machine. I'm now trying to run an app's test suite, but keep getting database errors.
Failure/Error: user = FactoryGirl.create(:user)
PG::ConnectionBad:
FATAL: database "test-db" does not exist
My database.yml file is set up correctly. I've run psql -l
and test-db does in fact exist, and this is confirmed by running rake db:create
where I get an 'already exists' message.
I've run rake db:migrate
and rake:test:prepare
, but the error still remains.
My test set up is as follows
group :test do
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'capybara'
gem 'guard-rspec'
gem 'spork-rails'
gem 'guard-spork'
end
I'm having no trouble with the development database.
Why am I getting a db does not exist error, and what can I do to debug this?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With