On Jan 19, 2:11 pm, Nelson Hsu <[email protected]>
wrote:
> I've heard about TDD, read about TDD, and now I'm trying to practice it.
> However, I'm getting stuck trying to do a simple test in rails 2.2.2.
> I've decided to try writing a simple functional test to test the
> 'add_item' action of my cart controller.
>
> However, I got as far as this before my test was already not running:
>
> test "should add an item to the cart" do
>
> end
>
> My cart controller uses two 'fake' models (cart_session,
> cart_session_line_item) that aren't activerecords.  however i'm getting
> this error message:
>
> ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table:
> cart_sessi
> on_line_items: DELETE FROM "cart_session_line_items" WHERE 1=1
>
> for the life of me, I don't understand why my test would be hitting the
> database yet when my test body is blank and why it thinks that
> cart_session_line_item is an activerecord when it's not wired up as
> such.
>

Are you sure your models are not inheriting from ActiveRecord::Base?

Even if you're not calling any methods on them yet, the sheer act of
deriving from ActiveRecord::Base will necessitate the presence of
those tables.


> i know TDD is a good thing, and any help would be greatly appreciated!
>
> Thanks,
> Nelson

TDD is a good thing!  Let's see if we can't get this working for you.

Jeff
purpleworkshops.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to