Mock request for sponsor image
This commit is contained in:
parent
9668a40248
commit
b553b95143
1 changed files with 16 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ WebMock.disable_net_connect!(allow_localhost: true, allow: [*driver_urls, /strip
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
config.before(:each) do
|
config.before(:each) do
|
||||||
mock_commercial_request
|
mock_commercial_request
|
||||||
|
mock_image_request
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -32,3 +33,18 @@ def mock_commercial_request
|
||||||
WebMock.stub_request(:get, /.*youtube.*/)
|
WebMock.stub_request(:get, /.*youtube.*/)
|
||||||
.to_return(status: 200, body: response.to_json, headers: {})
|
.to_return(status: 200, body: response.to_json, headers: {})
|
||||||
end
|
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue