title: Rspec: How to test recursion?
body: <p>I'd like to test that a method is called recursively with a specific argument.</p>
  
  <p>My approach:</p>
  
  <pre><code>class Recursable
    def rec(arg)
      rec(7) unless arg == 7
    end
  end
  
  describe Recursable do
    it "should recurse" do
      r = Recursable.new('test')
      r.should_receive(:rec).with(0).ordered
      r.should_receive(:rec).with(7).ordered
      r.rec(0)
    end
  end
  </code></pre>
  
  <p>Unexpectedly, RSpec fails with:</p>
  
  <pre><code>expected :rec with (7) once, but received it 0 times
  </code></pre>
  
  <p>Any idea what's wrong with my approach? How to test for effective recursion with a specific argument?</p>