我跑rake test
並得到了以下錯誤:耙測試失敗 - RunTimeError
/Users/username/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-3.2.7/lib/active_record/connection_adapters/postgresql_adapter.rb:1213:in `initialize': could not connect to server: Permission denied (PG::Error)
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
.
.
. (many filenames)
.
.
Errors running test:units! #<PG::Error: could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
>
Errors running test:functionals! #<RuntimeError: Command failed with status (1): [/Users/username/.rvm/rubies/ruby-2.0.0-p0/bin/...]>
是什麼意思?我該怎麼做才能解決這個問題? 也,它似乎與PostgresSql,但我不使用該數據庫,我相信。 (哪裏可以檢查?)所以它沒有任何意義...
更新:我錯了,有postgresql。 這是我的config/database.yml
文件:
test:
adapter: postgresql
encoding: unicode
database: db_test
pool: 5
username: db
password:
production:
adapter: postgresql
encoding: unicode
database: db_production
host: xx.xxx.xxx.xxx
pool: 5
username: xxxxx
password: xxxxxxx
這裏從我的Gemfile的數據:
#Running a Postgres Database
gem 'pg'
#And using redis for KVS
gem 'redis'
#Behind a Thin Server
gem 'thin'
我現在的工作我的本地機器上,這是一個項目,我拉。也許我的本地機器有一個特定的數據庫(我使用mysql我相信),但應用程序期待另一個?
更新: 我的本地計算機(Mac OS)確實有postgresql,我可以使用which psql
找到它。如何配置數據庫並使其全部正常工作?
關於你的config/database.yml的信息可能很重要,你應該發佈它。之前刪除它的密碼! – pierallard
你在'Gemfile'中指定了哪個數據庫? –
謝謝@ForgetTheNorm和@ Alex Lynham,我剛剛發佈了其他信息 –