title: RSpec: how to test if a method was called?
body: <p>When writing RSpec tests, I find myself writing a lot of code that looks like this in order to ensure that a method was called during the execution of a test (for the sake of argument, let's just say I can't really interrogate the state of the object after the call because the operation the method performs is not easy to see the effect of).</p>
  
  <pre><code>describe "#foo"
    it "should call 'bar' with appropriate arguments" do
      called_bar = false
      subject.stub(:bar).with("an argument I want") { called_bar = true }
      subject.foo
      expect(called_bar).to be_true
    end
  end
  </code></pre>
  
  <p>What I want to know is: Is there a nicer syntax available than this? Am I missing some funky RSpec awesomeness that would reduce the above code down to a few lines? <code>should_receive</code> sounds like it should do this but reading further it sounds like that's not exactly what it does. </p>