mardi 16 avril 2019

ActiveRecord scope invocation test

I want to test/find out whether particular scope in my active record model was invoked during code fragment execution.

The standard way to check that via ModelName.expects(:method_name).once does not work for scopes defined within model. The query I am building adds/chains new scopes conditionally. It would be great to check how it was built without actually executing SQL query.

Aucun commentaire:

Enregistrer un commentaire