blob: 11aa8e3e52975801d11b86e6b8af84b900edf51e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Analytics::CycleAnalytics::RequestParams, feature_category: :value_stream_management do
it_behaves_like 'unlicensed cycle analytics request params' do
let_it_be(:user) { create(:user) }
let_it_be(:root_group) { create(:group) }
let_it_be_with_refind(:project) { create(:project, group: root_group) }
let(:namespace) { project.project_namespace }
describe 'project-level data attributes' do
subject(:attributes) { described_class.new(params).to_data_attributes }
it 'includes the namespace attribute' do
expect(attributes).to match(hash_including({
namespace: {
name: project.name,
full_path: project.full_path
}
}))
end
context 'with a subgroup project' do
let_it_be(:sub_group) { create(:group, parent: root_group) }
let_it_be_with_refind(:subgroup_project) { create(:project, group: sub_group) }
let(:namespace) { subgroup_project.project_namespace }
it 'includes the correct group_path' do
expect(attributes).to match(hash_including({
group_path: "groups/#{subgroup_project.namespace.full_path}",
full_path: subgroup_project.full_path
}))
end
end
end
end
end
|