Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rspec : PG::ConnectionBad: PQsocket() can't get socket descriptor

I run my rspec and most of the test were failed. I got the same error for them, which is:

    Failure/Error: Unable to find matching line from backtrace
    ActiveRecord::StatementInvalid:
    PG::ConnectionBad: PQsocket() can't get socket descriptor: BEGIN

I found a question that is similar to my problem, but there is no answer yet and I also tried the solution from this link, but it didn't make any differences for me. I opened my test console and run some simplest queries and it worked.

like image 983
ishwr Avatar asked May 13 '14 08:05

ishwr


1 Answers

There may be a problem with pg: '0.18.1'. I tried reverting to 0.18.0, and I believe the problem has gone away.

I'll open up an issue on the repo after testing a bit more locally. I added this issue on the pg repo.

EDIT: I was wrong. What did in fact help though, was installing the spring-commands-rspec gem. I think what it ended up doing for me was caching it in a state where it worked. Although it could also just as easily cache it in a state where it didn't.

like image 155
BJ McDuck Avatar answered Oct 22 '22 16:10

BJ McDuck