diff --git a/spec/lgtm_spec.rb b/spec/lgtm_spec.rb index e7a8177..0d472bf 100644 --- a/spec/lgtm_spec.rb +++ b/spec/lgtm_spec.rb @@ -25,13 +25,21 @@ module Danger expect(@dangerfile.status_report[:markdowns].length).to eq(1) end + it 'lgtm with default url is OverQuota' do + allow(Net::HTTP).to receive(:start).and_return(mock(code: '503')) + + expect(@dangerfile.status_report[:markdowns]).to be_empty + end + def mock(request_url: 'https://lgtm.in/p/sSuI4hm0q', - actual_image_url: 'https://example.com/image.jpg') + actual_image_url: 'https://example.com/image.jpg', + code: '200') double( :[] => request_url, body: JSON.generate( actualImageUrl: actual_image_url - ) + ), + code: code ) end