0

I'v been using Rspec in my project since the beginning. I'm using another computer, then I clone my repository.

When I run: rspec/spec or if i run guard, I'm getting this error:

/home/charles/.rvm/gems/ruby-2.2.5@vproject/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in 'initialize': FATAL:  password authentication failed for user "postgres" (PG::ConnectionBad)

Thing is, I never has this problem before. I can run migrations without problems. The weird part is: I configured rspec again. I deleted all files and I re-configured rspec again. If I run rspec/spec, everyhing works fin. BUT, if I copy and paste any code into the new project, I'm getting the error again.

So, for example, I have this file: spec/controllers/authors_controller_spec.rb and the file is blank, everything is ok. But, if I type or copy and paste the code from the original project, I'm getting the error.

Any help will be welcome

1
  • It may be due to ruby version and guard version. Commented Jul 21, 2016 at 16:11

1 Answer 1

2

The problem sounds like that with a blank file it's not making any DB requests - however as soon as you copy in code, it tries to hit the database and fails.

Double check your test environment database credentials (#config/database.yml) and ensure that it is using a username and password that matches the one set up in postgresql on your current machine.

Also, make sure you have run:

bundle exec rake db:test:prepare

Which will prepare your test database

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.