diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-20 23:50:22 +0000 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/helpers/sidebars_helper_spec.rb | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) | |
download | gitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/helpers/sidebars_helper_spec.rb')
-rw-r--r-- | spec/helpers/sidebars_helper_spec.rb | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/helpers/sidebars_helper_spec.rb b/spec/helpers/sidebars_helper_spec.rb new file mode 100644 index 00000000000..e329968e6c0 --- /dev/null +++ b/spec/helpers/sidebars_helper_spec.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe SidebarsHelper do + describe '#sidebar_tracking_attributes_by_object' do + subject { helper.sidebar_tracking_attributes_by_object(object) } + + before do + allow(helper).to receive(:tracking_enabled?).and_return(true) + end + + context 'when object is a project' do + let(:object) { build(:project) } + + it 'returns tracking attrs for project' do + expect(subject[:data]).to eq({ track_label: 'projects_side_navigation', track_property: 'projects_side_navigation', track_action: 'render' }) + end + end + + context 'when object is a group' do + let(:object) { build(:group) } + + it 'returns tracking attrs for group' do + expect(subject[:data]).to eq({ track_label: 'groups_side_navigation', track_property: 'groups_side_navigation', track_action: 'render' }) + end + end + + context 'when object is a user' do + let(:object) { build(:user) } + + it 'returns tracking attrs for user' do + expect(subject[:data]).to eq({ track_label: 'user_side_navigation', track_property: 'user_side_navigation', track_action: 'render' }) + end + end + + context 'when object is something else' do + let(:object) { build(:ci_pipeline) } + + it 'returns no attributes' do + expect(subject).to eq({}) + end + end + end +end |