Commit fe9c9415 authored by Marin Jankovski's avatar Marin Jankovski

Check if license exists before checking the addon.

parent e87728dc
...@@ -54,7 +54,9 @@ module Gitlab ...@@ -54,7 +54,9 @@ module Gitlab
end end
def service_desk_counts def service_desk_counts
return {} unless ::License.current.add_on?('GitLab_ServiceDesk') license = ::License.current
return {} if license.nil?
return {} unless license.add_on?('GitLab_ServiceDesk')
projects_with_service_desk = Project.where(service_desk_enabled: true) projects_with_service_desk = Project.where(service_desk_enabled: true)
......
...@@ -103,6 +103,12 @@ describe Gitlab::UsageData do ...@@ -103,6 +103,12 @@ describe Gitlab::UsageData do
end end
end end
context 'when there is no license' do
it 'returns an empty hash' do
expect(subject).to eq({})
end
end
context 'when Service Desk is enabled' do context 'when Service Desk is enabled' do
it 'gathers Service Desk data' do it 'gathers Service Desk data' do
create_list(:issue, 3, confidential: true, author: User.support_bot, project: [project3, project4].sample) 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