diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-20 12:16:11 +0300 |
commit | edaa33dee2ff2f7ea3fac488d41558eb5f86d68c (patch) | |
tree | 11f143effbfeba52329fb7afbd05e6e2a3790241 /spec/helpers/application_helper_spec.rb | |
parent | d8a5691316400a0f7ec4f83832698f1988eb27c1 (diff) |
Add latest changes from gitlab-org/gitlab@14-7-stable-eev14.7.0-rc42
Diffstat (limited to 'spec/helpers/application_helper_spec.rb')
-rw-r--r-- | spec/helpers/application_helper_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 7390b9b3f58..8c2b4b16075 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -477,4 +477,44 @@ RSpec.describe ApplicationHelper do expect(helper).to have_received(:form_for).with(user, expected_options) end end + + describe '#page_class' do + context 'when logged_out_marketing_header experiment is enabled' do + let_it_be(:expected_class) { 'logged-out-marketing-header-candidate' } + + let(:current_user) { nil } + let(:variant) { :candidate } + + subject do + helper.page_class.flatten + end + + before do + stub_experiments(logged_out_marketing_header: variant) + allow(helper).to receive(:current_user) { current_user } + end + + context 'when candidate' do + it { is_expected.to include(expected_class) } + end + + context 'when candidate (:trial_focused variant)' do + let(:variant) { :trial_focused } + + it { is_expected.to include(expected_class) } + end + + context 'when control' do + let(:variant) { :control } + + it { is_expected.not_to include(expected_class) } + end + + context 'when a user is logged in' do + let(:current_user) { create(:user) } + + it { is_expected.not_to include(expected_class) } + end + end + end end |