How to say “any_instance” “should_receive” any number of times in RSpec
Here’s a better answer that avoids having to override the :new method: save_count = 0 <Model>.any_instance.stub(:save) do |arg| # The evaluation context is the rspec group instance, # arg are the arguments to the function. I can’t see a # way to get the actual <Model> instance 🙁 save_count+=1 end …. run the test here … Read more