Mock request for sponsor image

This commit is contained in:
Michael Ball 2021-02-23 22:11:37 -08:00
parent 9668a40248
commit b553b95143

View file

@ -10,6 +10,7 @@ WebMock.disable_net_connect!(allow_localhost: true, allow: [*driver_urls, /strip
RSpec.configure do |config|
config.before(:each) do
mock_commercial_request
mock_image_request
end
end
@ -32,3 +33,18 @@ def mock_commercial_request
WebMock.stub_request(:get, /.*youtube.*/)
.to_return(status: 200, body: response.to_json, headers: {})
end
def mock_image_request
WebMock.stub_request(:post, "https://api.cloudinary.com/v1_1/snapcon/image/destroy").
with(
body: {},
headers: {
'Accept'=>'*/*',
'Accept-Encoding'=>'gzip, deflate',
'Content-Length'=>'111',
'Content-Type'=>'application/x-www-form-urlencoded',
'Host'=>'api.cloudinary.com',
'User-Agent'=>'CloudinaryRuby/1.11.1'
}).
to_return(status: 200, body: {}.to_json, headers: {})
end