Commit cc30d5d0 authored by Alex Buijs's avatar Alex Buijs

Set a cookie when creating Learn Gitlab project

parent 4c1dff36
......@@ -25,9 +25,16 @@ module Registrations
private
def create_learn_gitlab_project
File.open(learn_gitlab_template_path) do |archive|
::Projects::GitlabProjectsImportService.new(current_user, namespace_id: @project.namespace_id, file: archive, name: s_('Learn GitLab')).execute
learn_gitlab_project = File.open(learn_gitlab_template_path) do |archive|
::Projects::GitlabProjectsImportService.new(
current_user,
namespace_id: @project.namespace_id,
file: archive,
name: s_('Learn GitLab')
).execute
end
cookies[:onboarding_issues_settings] = { 'groups#show' => true, 'projects#show' => true, 'issues#index' => true }.to_json if learn_gitlab_project.saved?
end
def learn_gitlab_template_path
......
......@@ -64,7 +64,7 @@ RSpec.describe Registrations::ProjectsController do
stub_experiment_for_user(onboarding_issues: true)
end
it 'creates a new project, a "Learn GitLab" project and redirects to the experience level page' do
it 'creates a new project, a "Learn GitLab" project, sets a cookie and redirects to the experience level page' do
expect { subject }.to change { namespace.projects.pluck(:name) }.from([]).to(['New project', s_('Learn GitLab')])
Sidekiq::Worker.drain_all
......@@ -72,6 +72,7 @@ RSpec.describe Registrations::ProjectsController do
expect(subject).to have_gitlab_http_status(:redirect)
expect(subject).to redirect_to(users_sign_up_experience_level_path)
expect(namespace.projects.find_by_name(s_('Learn GitLab'))).to be_import_finished
expect(cookies[:onboarding_issues_settings]).not_to be_nil
end
context 'when the project cannot be saved' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment