bblimke / webmock

Library for stubbing and setting expectations on HTTP requests in Ruby.
MIT License
3.98k stars 555 forks source link

`stub_request().to_return(body: obj)` should fail fast when given an invalid body object #389

Open myronmarston opened 10 years ago

myronmarston commented 10 years ago

In vcr/vcr#407, a user reported an issue with VCR that was due to their use of:

stub_request(:get, remote_file_url)
        .to_return(body: fixture_file('post_photo.jpg'))

VCR expects the body provided by WebMock to be a String but it was a Rack::Test::UploadedFile object. WebMock should fail fast when given a body object it does not support, as discussed in that ticket.

bblimke commented 10 years ago

@myronmarston Thanks for reporting it. That makes sense.