开发者

Testing with PostgreSQL in Rails 3

开发者 https://www.devze.com 2023-03-27 21:49 出处:网络
I am trying to switch my Rails TEST environment from SQLite3 to Postgresql. However, when I run rake spec:requests

I am trying to switch my Rails TEST environment from SQLite3 to Postgresql.

However, when I run

rake spec:requests

this error is generated:

omar@loco:~/apps/gctest$ rake spec:requests
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.[]

Tasks:开发者_开发知识库 TOP => db:test:load => db:test:purge
(See full trace by running task with --trace)

I am able to access the DB in Development (my database.yml file for test looks similar to development but with _test).

Are there any gotchas that I'm unaware of? what does the "Tasks:..." line mean?

My env:

rspec (2.6.0)
rails (3.0.9)
ruby 1.9.2p290
pg (0.11.0)
psql (PostgreSQL) 8.4.8


I have a suspicion that you do not have the test key in your database.yml file and Rails is attempting to use that and not finding it. However, I could be wrong. That does look like that kind of issue though.

What does --trace at the end of that command make it output extra? Perhaps you could update the question with that output to help us?

0

精彩评论

暂无评论...
验证码 换一张
取 消