diff --git a/spec/support/external_request.rb b/spec/support/external_request.rb index a3ebf939..5706f049 100644 --- a/spec/support/external_request.rb +++ b/spec/support/external_request.rb @@ -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