Do you want to mock exact response (body and headers) for some file download?
VCR is overkill for such small task. One can handcraft it and pass to WebMock's stub_request
. I'd rather go with saving full real response.
There are fine istructions in WebMock README. I want to share it here for reference:
Replaying raw responses recorded with curl -is
In console:
curl -is www.example.com > /tmp/example_curl_-is_output.txt
In your test:
raw_response_file = File.new("/tmp/example_curl_-is_output.txt")
stub_request(:get, "www.example.com").to_return(raw_response_file)
Top comments (0)