title: RSpec: Stub chains with arguments?
body: <p>Just wondering if/how arguments can be passed in rspec stub chains. To give an example, suppose I have the following action:</p>
  
  <pre><code>def index
    @payments = Payment.order(:updated_at).where(:paid =&gt; true)
    @bad_payments = Payment.order(:some_other_field).where(:paid =&gt; false)
  end
  </code></pre>
  
  <p>In my controller spec, I'd like to be able to stub out both methods and return different results. If only the <code>@payments</code> field were in the action I'd use something like</p>
  
  <pre><code>Payment.stub_chain(:order, :where) { return_this }
  </code></pre>
  
  <p>But of course, that will return the same value for <code>@bad_payments</code>.</p>
  
  <p>So - in short, how do I include the <code>:updated_at</code> and <code>:paid =&gt; true</code> as stub conditions?</p>