summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-07-13 21:38:26 -0700
committerStan Hu <stanhu@gmail.com>2017-07-13 21:38:26 -0700
commit0e23d1a74ff6283076e9a1d74eccfc5ba6419fd8 (patch)
treeacbd4550fd800053fac5ee70acac972bd3c4ffe9 /spec
parentdbcc0e03ac82d6b90fc93b1fefac8ce80c741178 (diff)
downloadgitlab-ce-0e23d1a74ff6283076e9a1d74eccfc5ba6419fd8.tar.gz
Handle case when BroadcastMessage.current is nil
Somehow Rails.cache.fetch occasionally returns `nil` values, which causes this endpoint to crash. Closes #35094
Diffstat (limited to 'spec')
-rw-r--r--spec/requests/api/internal_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/requests/api/internal_spec.rb b/spec/requests/api/internal_spec.rb
index 453eb4683a0..beaaf346283 100644
--- a/spec/requests/api/internal_spec.rb
+++ b/spec/requests/api/internal_spec.rb
@@ -35,6 +35,17 @@ describe API::Internal do
expect(json_response).to be_empty
end
end
+
+ context 'nil broadcast message' do
+ it 'returns nothing' do
+ allow(BroadcastMessage).to receive(:current).and_return(nil)
+
+ get api('/internal/broadcast_message'), secret_token: secret_token
+
+ expect(response).to have_http_status(200)
+ expect(json_response).to be_empty
+ end
+ end
end
describe 'GET /internal/broadcast_messages' do