Commit 02a8ada8 authored by Alper Akgun's avatar Alper Akgun Committed by Rémy Coutable

Trial form "for company" choice

Ask if a user is trying GitLab for his company or  for his individual
usage
parent c2811c1c
......@@ -66,7 +66,7 @@ class TrialsController < ApplicationController
gl_com_params = { gitlab_com_trial: true, sync_to_gl: true }
{
trial_user: params.permit(:namespace_id).merge(gl_com_params),
trial_user: params.permit(:namespace_id, :trial_entity).merge(gl_com_params),
uid: current_user.id
}
end
......
......@@ -15,6 +15,15 @@
#group_name.form-group.hidden
= label_tag :new_group_name, _('New Group Name'), for: :new_group_name, class: 'col-form-label'
= text_field_tag :new_group_name, nil, class: 'form-control'
.form-group
= label_tag :trial_entity, _('Is this GitLab trial for your company?')
.gl-form-checkbox-group
.gl-form-checkbox.form-check.form-check-inline
= radio_button_tag :trial_entity, :company, false, required: true, class: 'form-check-input'
= label_tag :trial_entity_company, _('Yes'), class: 'form-check-label'
.gl-form-checkbox.form-check.form-check-inline
= radio_button_tag :trial_entity, :individual, false, required: true, class: 'form-check-input'
= label_tag :trial_entity_individual, _('No'), class: 'form-check-label'
= submit_tag _('Start your free trial'), class: 'btn btn-success btn-block'
= render 'skip_trial'
---
title: Ask if a user is trying GitLab for his company or for his individual usage
merge_request: 22280
author:
type: added
......@@ -152,5 +152,20 @@ describe TrialsController do
end
end
end
it "calls the ApplyTrialService with correct parameters" do
gl_com_params = { gitlab_com_trial: true, sync_to_gl: true }
post_params = { namespace_id: namespace.id.to_s, trial_entity: 'company' }
apply_trial_params = {
uid: user.id,
trial_user: ActionController::Parameters.new(post_params).permit(:namespace_id, :trial_entity).merge(gl_com_params)
}
expect_next_instance_of(GitlabSubscriptions::ApplyTrialService) do |service|
expect(service).to receive(:execute).with(apply_trial_params).and_return({ success: true })
end
post :apply, params: post_params
end
end
end
......@@ -19,11 +19,13 @@ describe 'Trial Select Namespace', :js do
visit select_trials_path
wait_for_all_requests
choose :trial_entity_company
select2 '0', from: '#namespace_id'
end
it 'shows the new group name input' do
expect(page).to have_field('New Group Name')
expect(page).to have_content('Is this GitLab trial for your company?')
end
context 'enters a valid new group name' do
......@@ -99,12 +101,14 @@ describe 'Trial Select Namespace', :js do
visit select_trials_path
wait_for_all_requests
choose :trial_entity_company
select2 user.namespace.id, from: '#namespace_id'
end
context 'without trial plan' do
it 'does not show the new group name input' do
expect(page).not_to have_field('New Group Name')
expect(page).to have_content('Is this GitLab trial for your company?')
end
it 'applies trial and redirects to dashboard' do
......
......@@ -10470,6 +10470,9 @@ msgstr ""
msgid "Is blocked by"
msgstr ""
msgid "Is this GitLab trial for your company?"
msgstr ""
msgid "Is using license seat:"
msgstr ""
......
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