简体   繁体   中英

Postgres connection fails, uses system user instead the one provided in database.yml

I am trying to run some rspec tests for my Rails app but I get a Postgres connection error. It uses my system user, instead of the one I provided for the dev environement, in database.yml. Could someone have a look please? And maybe give me some doc to help me understand how it searches for the user role?

An error occurred while loading ./spec/helpers/navigation_helper_spec.rb.
Failure/Error: ActiveRecord::Migration.maintain_test_schema!
ActiveRecord::NoDatabaseError:
FATAL:  role "yopeso_internship" does not exist
# ./spec/rails_helper.rb:28:in `<top (required)>'
# ./spec/helpers/navigation_helper_spec.rb:1:in `<top (required)>'

# --- Caused by: ---
# PG::ConnectionBad:
#   FATAL:  role "yopeso_internship" does not exist
#   ./spec/rails_helper.rb:28:in `<top (required)>'

In your database.yml you are not providing valid credentials for your test environment like you did for development .

Also show your database.yml .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM