From 549a1f9f53de7bdf94268fe5a1b0127d663262c8 Mon Sep 17 00:00:00 2001 From: Ryota Ikezawa Date: Tue, 31 Jul 2018 16:23:48 +0900 Subject: [PATCH] Add spec --- spec/lgtm_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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