Commit 3c1f90fc authored by Victor Zagorodny's avatar Victor Zagorodny

Add tests for UsageData preferences usage data

parent 6a549be4
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
require 'spec_helper' require 'spec_helper'
describe Gitlab::UsageData do describe Gitlab::UsageData do
let(:projects) { create_list(:project, 3) } let(:group) { create(:group) }
let(:projects) { create_list(:project, 3, group: group) }
let!(:board) { create(:board, project: projects[0]) } let!(:board) { create(:board, project: projects[0]) }
describe '#data' do describe '#data' do
...@@ -24,6 +25,9 @@ describe Gitlab::UsageData do ...@@ -24,6 +25,9 @@ describe Gitlab::UsageData do
create(:package, project: projects[1]) create(:package, project: projects[1])
create(:project_tracing_setting, project: projects[0]) create(:project_tracing_setting, project: projects[0])
# should be all different creators according to the spec/factories/projects.rb
projects.each { |p| p.creator.update!(group_view: :security_dashboard) }
end end
subject { described_class.data } subject { described_class.data }
...@@ -90,6 +94,13 @@ describe Gitlab::UsageData do ...@@ -90,6 +94,13 @@ describe Gitlab::UsageData do
expect(count_data[:license_management_jobs]).to eq(1) expect(count_data[:license_management_jobs]).to eq(1)
expect(count_data[:sast_jobs]).to eq(1) expect(count_data[:sast_jobs]).to eq(1)
end end
it 'gathers security-related preferences usage data' do
expect(subject[:counts]).to include(
preference_group_overview_details: User.count - 3,
preference_group_overview_security_dashboard: 3
)
end
end end
describe '#features_usage_data_ee' do describe '#features_usage_data_ee' do
......
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