Forum: Ruby on Rails Test Associations are Preloaded

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2ebf42f8625b86c0e91ae7bd4e2bef52?d=identicon&s=25 Raymond O'Connor (nappin)
on 2007-05-03 00:28
What's the best way to test that all assocaitions are preloaded when a
method is called?

For example, do_something is a method that makes a db call and preloads
several associations.  Is there a way to write a test that checks that
calls to do_something only make one db call?

On the functional level is there a way to write tests that check that
actions only trigger a certain number of db queries (counting only loads
and not the select column queries).

Cheers, Ray
This topic is locked and can not be replied to.