Hi all Been reading a couple of article''s and recently watched the Railscast on Unit tests that don''t require fixtures. While I can follow the basic examples given, I''m struggling to find a way to test methods that call directly from the database. For example, In my Order.rb class, I have a class method called any_pending? Order.any_pending? Which should return a boolean true if there are any orders on the database that haven''t been paid. to simplify: Class Order def any_pending? find(:first, :conditions => {:status => PENDING}).any? end end How can I simulate this without using fixtures? I run into the same problem when testing methods through associations. Batches have many orders, how can I test Batch.first.orders.any_pending? without calling from the database? http://blog.jayfields.com/2006/06/ruby-on-rails-unit-tests.html http://blog.jayfields.com/2006/12/rails-activerecord-unit-testing.html Thanks :S --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---