开发者

Problem in RoR testing

I reading/learning "agile develpment.." now i'm on Chapter 14 (testing)/

when i tried to run "@ruby -I test test/unit/product_test.rb" i have error that

1) Error:
test_invalid_with_empty_attributes(ProductTest):
ActiveRecord::StatementInvalid: PGError: ERROR:  relation "carts" does not exist
LINE 1: DELETE FROM "carts"
               开发者_JAVA技巧     ^
: DELETE FROM "carts"

but cart model isn't belongs to "ActiveRecord"

what i'm doing wrong?

(sorry for mistakes, i'm bad in english)


It looks like the database table "carts" does not exist. Rails tests use the 'test' database defined in database.yml. You probably have yet to create the test database, or the database schema may be out of date. Try running rake db:test:load or rake db:test:prepare to recreate the test database.

You can read more by running rake --tasks db:test or checking out the RubyOnRails.org guide to testing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜