title: Does should_receive do something I don't expect?
body: <p>
  Consider the following two trivial models:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>class Iq
  
    def score
      #Some Irrelevant Code
    end
  
  end
  
  class Person
  
    def iq_score
      Iq.new(self).score   #error here
    end
  
  end
  </code></pre>
  
  <p>And the following Rspec test:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>describe "#iq_score" do
  
    let(:person) { Person.new }
  
    it "creates an instance of Iq with the person" do
      Iq.should_receive(:new).with(person)
      Iq.any_instance.stub(:score).and_return(100.0)
      person.iq_score
    end
  
  end
  </code></pre>
  
  <p>When I run this test (or, rather, an analogous one), it appears the stub has not worked:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>Failure/Error: person.iq_score
    NoMethodError:
      undefined method `iq_score' for nil:NilClass
  </code></pre>
  
  <p>The failure, as you might guess, is on the line marked "error here" above. When the <code>should_receive</code> line is commented out, this error disappears. What's going on?</p>