I often pull in other models (via fixtures). Fixtures are all "fake"
made up data anway, and it''s a rare app where every model exists in
isolation...
On 9/8/06, stewbawka <stewbawka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> ok, i''ve written a couple of unit tests and it was pretty straight
> forward as far as what i should and shouldn''t be testing in the
unit
> test.. until now.
>
> i am testing a customer model right now.. i figure that a unit test
> should test the functions of a model as well as if you can do all the
> crud stuff and validations. right now i wish to test a customer model
> function that returns what level of customer they are.. this is based
> on what things they''ve ordered in the past. so my question: is it
ok to
> bring in other models when doing unit tests? i figure i will have to
> load at least 3 other test fixtures to test this out (orders,
> order_items, and inventory), but not even sure if i can actually use
> the other models in the customer unit test because i tried putting test
> = Order.new in my test and it failed on that line.. i''m starting
to
> think that maybe this aspect shouldn''t be tested in the unit test?
>
> thanks in advance
>
> stuart
>
>
> >
>
--
We must beware of needless innovations, especially when guided by
logic. -- Winston Churchill
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---