title: Rspec: How to expect received message without stubbing anything or changing anything behind the scenes
body: <p>I have this Rspec test for a rails app</p>
  
  <pre><code>  describe '.move_probes_to_master_list' do
      let(:as) { create_list :a, 3, }
      let(:bs) { create_list :b, 3 }
  
      it 'sums the volumes' do
  
        active_as= [as[1], as[2]]
        b_ids = [2, 3]
        expect_any_instance_of(A)
          .to receive(:required_volume).twice.with(b_ids)
        expect_any_instance_of(A)
          .to receive(:update_move_to_master_list).twice
  
        expect(A.calculate_volume(active_as)).to eq(true)
      end
    end
  </code></pre>
  
  <p>Basically I call <code>A.calculate_volume</code> and inside this class method, I want to ensure that some member of the <code>A</code> class is recieving some other messages as well. I don't want to stub out those methods, I want them to run as normal, but I just want to verify that the methods are being called.</p>
  
  <p>This is being run in a loop, so I don't know exactly what instances I'll be dealling with, but I want to make sure that both messages are called on some members (but not necessarily the same member both times) of the <code>A</code> class twice in total.</p>
  
  <p>If I remove the <code>expect_any_instance_of(A).to receive</code> expectations everything runs fine and the test passes.</p>
  
  <p>If I keep them, the method call fails and the test breaks.</p>
  
  <p>I tried adding <code>and_call_original</code> but I feel like I'm shooting in the dark because the docs aren't clear on how these methods actually operate.</p>
  
  <p>So how can I verify that an instance of some class recieves a message <code>n</code> times without changing anything else about the method call?</p>
  
  <p>Am I missing the point of expect to receive here? It's not obvious to me why it would stub anything in the first place.</p>