Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Rails规范测试错误,未提供密码_Postgresql_Ruby On Rails 4_Testing_Rspec - Fatal编程技术网

Postgresql Rails规范测试错误,未提供密码

Postgresql Rails规范测试错误,未提供密码,postgresql,ruby-on-rails-4,testing,rspec,Postgresql,Ruby On Rails 4,Testing,Rspec,我有一个现有的项目,创建于许多年前。我们公司没有一个人能成功地运行它们。我已经更新了文件以适应最新的rails版本,但是当我运行bundle exec rspec spec/models/promo_code_spec.rb时 我明白了 /Users/mmiller/.rvm/gems/ruby-2.1.6@global/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:8

我有一个现有的项目,创建于许多年前。我们公司没有一个人能成功地运行它们。我已经更新了文件以适应最新的rails版本,但是当我运行bundle exec rspec spec/models/promo_code_spec.rb时

我明白了

   /Users/mmiller/.rvm/gems/ruby-2.1.6@global/gems/activerecord-4.1.9/lib/active_record/connection_adapters/postgresql_adapter.rb:888:in `initialize': fe_sendauth: no password supplied (PG::ConnectionBad)
我在这篇文章中遵循了以下步骤: 但仍然得到同样的错误。 对如何解决这个问题有什么建议吗

改变这个

local   all             all                                     trust
对,


然后用用户名和密码在PostgreSQL中创建一个super_用户,并将该用户名和密码添加到database.yml文件

Welp,对于我来说,作为Rails测试的一个全新用户,我在想使用RSpec而忘记创建测试数据库时遇到了这个错误。确保在database.yml中为测试数据库分配了自己的名称

一篇有帮助的文章提到了这个命令行来初始化东西:

bundle exec rake db:reset RAILS_ENV=test

然后转到joy…

请在您的yml中显示数据库部分。你知道你的用户名和密码吗?。。
bundle exec rake db:reset RAILS_ENV=test