Commit 278ed806 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'cohorts_page_without_license' into 'master'

Check if license exists before checking the addon.

Closes #2355

See merge request !1829
parents ad665709 5822b744
......@@ -54,7 +54,7 @@ module Gitlab
end
def service_desk_counts
return {} unless ::License.current.add_on?('GitLab_ServiceDesk')
return {} unless ::License.current&.add_on?('GitLab_ServiceDesk')
projects_with_service_desk = Project.where(service_desk_enabled: true)
......
......@@ -103,6 +103,14 @@ describe Gitlab::UsageData do
end
end
context 'when there is no license' do
it 'returns an empty hash' do
allow(License).to receive(:current).and_return(nil)
expect(subject).to eq({})
end
end
context 'when Service Desk is enabled' do
it 'gathers Service Desk data' do
create_list(:issue, 3, confidential: true, author: User.support_bot, project: [project3, project4].sample)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment