mardi 7 juin 2016

How to mock message chaining with rspec

I have a statement like Model.some_scope.pluck(:a_field) in a method I'd like to test.

What's the recommended way for me to stub the return value of this chained method call statement with rspec-mock 3.4.0? I saw stub_chain and receive_message_chain are both listed as old syntax on Rspec website.

Best Regards.

Aucun commentaire:

Enregistrer un commentaire