Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/registrations/experience_levels_controller_spec.rb')
-rw-r--r--spec/controllers/registrations/experience_levels_controller_spec.rb47
1 files changed, 32 insertions, 15 deletions
diff --git a/spec/controllers/registrations/experience_levels_controller_spec.rb b/spec/controllers/registrations/experience_levels_controller_spec.rb
index 1fc728f5de8..5a217a3a684 100644
--- a/spec/controllers/registrations/experience_levels_controller_spec.rb
+++ b/spec/controllers/registrations/experience_levels_controller_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-describe Registrations::ExperienceLevelsController do
+RSpec.describe Registrations::ExperienceLevelsController do
let_it_be(:namespace) { create(:group, path: 'group-path' ) }
let_it_be(:user) { create(:user) }
@@ -99,34 +99,51 @@ describe Registrations::ExperienceLevelsController do
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
+ context 'when a "Learn GitLab" project is available' do
before do
- request.cookies[:onboarding_issues_settings] = '{}'
+ allow_next_instance_of(LearnGitlab) do |learn_gitlab|
+ allow(learn_gitlab).to receive(:available?).and_return(true)
+ allow(learn_gitlab).to receive(:label).and_return(double(id: 1))
+ end
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)
+ it 'adds a BoardLabel' do
+ expect_next_instance_of(Boards::UpdateService) do |service|
+ expect(service).to receive(:execute)
+ end
+
+ subject
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] }
+ it 'does not add a BoardLabel' do
+ expect(Boards::UpdateService).not_to receive(:new)
+
+ subject
+ end
+ end
+ end
+
+ context 'when no "Learn GitLab" project exists' do
+ let(:params) { super().merge(experience_level: :novice) }
+
+ before do
+ allow_next_instance_of(LearnGitlab) do |learn_gitlab|
+ allow(learn_gitlab).to receive(:available?).and_return(false)
end
end
+
+ it 'does not add a BoardLabel' do
+ expect(Boards::UpdateService).not_to receive(:new)
+
+ subject
+ end
end
end
end