Rspec ActiveRecord::StatementInvalid:PG::ConnectionBad:PQsocket()可以';无法获取套接字描述符:开始

Rspec ActiveRecord::StatementInvalid:PG::ConnectionBad:PQsocket()可以';无法获取套接字描述符:开始,rspec,watir,Rspec,Watir,我是watir的新手,我正在尝试使用watir测试我的rails应用程序。我有下一个代码: require 'watir_helper' require 'spec_helper' RSpec.feature 'Questions hub', type: :request do let!(:user) { create(:user, email: 'test1@example.com', name: 'John', last_name: 'Stivens') } let!(:quest

我是watir的新手,我正在尝试使用watir测试我的rails应用程序。我有下一个代码:

require 'watir_helper'
require 'spec_helper'

RSpec.feature 'Questions hub', type: :request do
  let!(:user) { create(:user, email: 'test1@example.com', name: 'John', last_name: 'Stivens') }
  let!(:question) { create(:question, created_at: 'August 25, 2016', user: user) }

  describe 'Comments feature' do
    context 'When user signed in' do
      def sign_in_user
        goto new_user_session_path
        text_field(name: 'user[email]').set('test1@example.com')
        text_field(name: 'user[password]').set('12345678')
        button(name: 'commit').click
      end

      def visit_question_page_and_post_answer
        goto question_path(question)
        textarea(id: 'answer_content').set('Lorem Ipsum')
        button(name: 'commit').click
      end

      def add_comment_to_answer
        link(text: 'comments (0)').click
        link(text: 'Add Comment').when_present.click
        textarea(name: 'comment[content]').set('MyComment')
        button(name: 'commit').click
      end

      before do
        sign_in_user
        visit_question_page_and_post_answer
      end

      it "Check comments count when it's empty" do
        text.include? 'comments (0)'
      end

      it "Add comment to question's answer" do
        add_comment_to_answer

        text.include? 'MyComment'
        text.include? 'comments (1)'
      end

      it 'Comment has link to user profile' do
        add_comment_to_answer
        div(class: 'user-name-w').link(text: 'John Stivens').click # problem happens here
      end
    end
  end
end
当代码中有下一行时:

div(class: 'user-name-w').link(text: 'John Stivens').click
此测试失败,错误为:

ActiveRecord::StatementInvalid: PG::ConnectionBad: PQsocket() can't get socket descriptor: BEGIN
但是如果要完成之前的两个测试,第三个测试(出现问题的地方)将通过