我有一个新的Rails 5应用程序。我按照指示安装了spring
和spring-commands-rspec
宝石。我可以自己运行rspec
并且测试运行正常。但是,如果我运行Spring binstub bin/rspec
,我会得到这个:
Running via Spring preloader in process 227
/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `initialize': could not connect to server: No such file or directory (PG::ConnectionBad)
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
from /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `new'
from /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:671:in `connect'
from /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:217:in `initialize'
from /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `new'
from /usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/postgresql_adapter.rb:37:in `postgresql_connection'
etc...
我有一个使用binstub的Rails 4应用程序,bin/rspec
效果很好。是什么给了什么?
顺便说一句,rake spec
以相同的方式失败,因为该数据库连接错误。
答案 0 :(得分:0)
尴尬。我没有正确设置我的database.yml来继承*default
的设置,所以上面的消息告诉我没有数据库在运行。一旦我修好了,binstub再次工作。