Postgres连接失败,使用系统用户代替database.yml中提供的用户

时间:2019-01-07 10:44:52

标签: ruby-on-rails postgresql

我正在尝试为我的Rails应用程序运行一些rspec测试,但是出现Postgres连接错误。它使用我的系统用户,而不是我在database.yml中为开发环境提供的用户。有人可以看看吗?也许给我一些文档,以帮助我了解它如何搜索用户角色?

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)>'

1 个答案:

答案 0 :(得分:1)

database.yml中,您没有像在test environment中那样为development提供有效的凭据。

还要显示您的database.yml