I need to create a new test database (postgres) and am having trouble. It seems that when I try to run any tests it is attempting to connect to the production database which is worrisome for many reasons. Here is my database.yml currently.
test:
adapter: postgresql
encoding: unicode
database: xxxxxx-test
pool: 5
username: xxx
host: localhost
But when I run a test I see:
An error occurred while loading ./spec/models/recipe_spec.rb.
Failure/Error: ActiveRecord::Migration.maintain_test_schema!
PG::ConnectionBad:
FATAL: no pg_hba.conf entry for host "IP_ADDRESS", user "PRODUCTION_USER", database "PRODUCTION_DATABASE", SSL off
I'm not sure why this is happening or how I am supposed to set this up.
Here's my gemfile for test:
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15', '< 4.0'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
gem 'rspec-rails', '~> 3.5'
gem 'database_cleaner'
gem 'factory_bot_rails'
end
It's worth noting that I do not have database_cleaner
doing anything at the moment.