I’m curious if i can mock out somehow the testing of a counter cache.
Now I’m creating all the records to test the counter_cache. Is there any good practices to test counter cache effectively?
Edit:
I’m just interested in testing that, the counter cache exists on a certain association.
When you add the
:counter_cacheoption, ActiveRecord defines 2 callbacks (source code). You can use Mocha to check if the callback is executed.