Do you want to mock exact response (body and headers) for some file download?
There are fine istructions in WebMock README. I want to share it here for reference:
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)