title: How can I stub find_each for rspec testing in rails 3
body: <p>I was wondering how to test a find_each call in rspec. I'm used to simply stubbing what I want my models to return so I don't rely on test data in the db like this:</p>
  
  <pre><code>MyClass.stub(:find).and_return(my_mock)
  </code></pre>
  
  <p>However, in another class I'm doing this:</p>
  
  <pre><code>MyClass.find_each do |instance_of_my_class|
    do_stuff_here_on(instance_of_my_class)
  end
  </code></pre>
  
  <p>I find that if I do this:</p>
  
  <pre><code>MyClass.stub(:find_each).and_return([one_mock, two_mock])
  </code></pre>
  
  <p>in the spec test, the "do stuff here" part is not being executed. Does anyone know how to stub a find_each for rspec testing?</p>