I want to stub first two calls to HTTParty with raised exception and then, the third call, should return value.
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
but one allow override another one. how to set stub to raise errors for first few tries and then let it return a value?
to_return()
,to_raise()
orto_timeout
declarations – Rebuff