警卫和rspec - 不喜欢我的postgress:在database.yml中测试凭据

时间:2013-09-01 03:30:08

标签: ruby-on-rails postgresql rspec guard

所以我在database.yml

中设置了我的postgres
test:
  adapter: postgresql
  encoding: unicode
  database: startpoint
  hostname: localhost
  pool: 5
  username: postgres
  password: password

在终端我一般都会这样做:

psql -h localhous -d startpoint -U postrgres

它将我连接到数据库。

所以我试过了:

test:
  adapter: postgresql
  encoding: unicode
  database: startpoint
  hostname: localhost
  pool: 5
  username: postgres
  password: 

但是当守卫跑步时我得到:

`initialize': FATAL:  Peer authentication failed for user "postgres" (PG::ConnectionBad)

想法?

1 个答案:

答案 0 :(得分:0)

通过创建数据库并为应用的用户分配所有权以建立连接,确保正确设置了用户凭据。检查this