diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-15 21:08:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-15 21:08:43 +0300 |
commit | 3caf5a8a007d8d9e9a86b7c847b5d9cfa6d41843 (patch) | |
tree | 6831279652bf5379c4650e2fd44c69663e1260c8 /spec/controllers/registrations | |
parent | 4774fa00b74a9248b2d14fc424a8c2f1abb0a0de (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/registrations')
-rw-r--r-- | spec/controllers/registrations/experience_levels_controller_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/controllers/registrations/experience_levels_controller_spec.rb b/spec/controllers/registrations/experience_levels_controller_spec.rb index e67195cb932..1fc728f5de8 100644 --- a/spec/controllers/registrations/experience_levels_controller_spec.rb +++ b/spec/controllers/registrations/experience_levels_controller_spec.rb @@ -97,6 +97,38 @@ describe Registrations::ExperienceLevelsController do it { is_expected.to have_gitlab_http_status(:redirect) } it { is_expected.to redirect_to(root_path) } end + + describe 'applying the chosen level' do + context "when an 'onboarding_issues_settings' cookie does not exist" do + let(:params) { super().merge(experience_level: :novice) } + + it 'does not change the cookie' do + expect { subject }.not_to change { cookies[:onboarding_issues_settings] } + end + end + + context "when an 'onboarding_issues_settings' cookie does exist" do + before do + request.cookies[:onboarding_issues_settings] = '{}' + end + + context 'when novice' do + let(:params) { super().merge(experience_level: :novice) } + + it "adds a 'hideAdvanced' setting to the cookie" do + expect { subject }.to change { Gitlab::Json.parse(cookies[:onboarding_issues_settings])['hideAdvanced'] }.from(nil).to(true) + end + end + + context 'when experienced' do + let(:params) { super().merge(experience_level: :experienced) } + + it 'does not change the cookie' do + expect { subject }.not_to change { cookies[:onboarding_issues_settings] } + end + end + end + end end context 'when user update fails' do |