RSpec sequence of returned values AND raised errors from stub
<p>I want to stub first two calls to HTTParty with raised exception and then, the third call, should return value.       </p>

<pre><code>   before do
          allow(HTTParty).to receive(:get).exactly(2).times.with(url).and_raise(HTTParty::Error)
          allow(HTTParty).to receive(:get).with(url).and_return('{}')
        end
</code></pre>

<p>but one allow override another one. how to set stub to raise errors for first few tries and then let it return a value?</p>