I'm writing tests using webmock, I need to simulate the remote api to return a 400 status, with body content,
if I just change the status from 200 to 400, with a body, the status I receive becomes 200.
let(:stub_result) { { result: 'failed', reason: 'blabla' }.to_json }
let!(:quote_stub) {
stub_request(:post, 'http://example.com/rest')
.to_return(status: 400, body: stub_result)
}
if I follow the manual and do:
stub_request(:post, 'http://example.com/rest')
.to_return(status: [400, body: stub_result])
I get the 400 status, but the body's empty.
any ideas?