views:

30

answers:

1

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"
                    ^
: DELETE FROM "carts"

but cart model isn't belongs to "ActiveRecord"

what i'm doing wrong?

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

+1  A: 

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.

Benjamin Manns