加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 使用Spork运行规范时“PGError:与服务器没有

发布时间:2020-12-17 03:59:14 所属栏目:百科 来源:网络整理
导读:我正在使用 Ruby 1.9.2,Rails 3.1,Rspec,Postgres和Spork,但我无法让它们一起玩得很好. 第一次运行规范(Spork在后台运行)运行正常.但是,当我第二次运行规范时,它失败了: Failure/Error: Unable to find matching line from backtrace PGError: no connectio
我正在使用 Ruby 1.9.2,Rails 3.1,Rspec,Postgres和Spork,但我无法让它们一起玩得很好.

第一次运行规范(Spork在后台运行)运行正常.但是,当我第二次运行规范时,它失败了:

Failure/Error: Unable to find matching line from backtrace
 PGError:
   no connection to the server
 # /Users/tom/.rvm/gems/ruby-1.9.2-p180@grapi/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/postgresql_adapter.rb:272:in `exec'
etc....

任何提示赞赏!

解决方法

您可能还启用了Devise.

您的问题在此处描述:https://github.com/sporkrb/spork/wiki/Spork.trap_method-Jujutsu
更具体地说,这里是rails 3.1:https://gist.github.com/1054078

spec_helper.rb和env.rb中的prefork块的开头应如下所示:

Spork.prefork do
  Spork.trap_method(Rails::Application,:reload_routes!)
  Spork.trap_method(Rails::Application::RoutesReloader,:reload!)
...

祝好运!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读