Reputation: 52
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
Upvotes: 0
Views: 686
Reputation: 2961
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
Upvotes: 2