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 ...@@ -66,7 +66,7 @@ class TrialsController < ApplicationController
gl_com_params = { gitlab_com_trial: true, sync_to_gl: true } 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 uid: current_user.id
} }
end end
......
...@@ -15,6 +15,15 @@ ...@@ -15,6 +15,15 @@
#group_name.form-group.hidden #group_name.form-group.hidden
= label_tag :new_group_name, _('New Group Name'), for: :new_group_name, class: 'col-form-label' = 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' = 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' = submit_tag _('Start your free trial'), class: 'btn btn-success btn-block'
= render 'skip_trial' = 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 ...@@ -152,5 +152,20 @@ describe TrialsController do
end end
end 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
end end
...@@ -19,11 +19,13 @@ describe 'Trial Select Namespace', :js do ...@@ -19,11 +19,13 @@ describe 'Trial Select Namespace', :js do
visit select_trials_path visit select_trials_path
wait_for_all_requests wait_for_all_requests
choose :trial_entity_company
select2 '0', from: '#namespace_id' select2 '0', from: '#namespace_id'
end end
it 'shows the new group name input' do it 'shows the new group name input' do
expect(page).to have_field('New Group Name') expect(page).to have_field('New Group Name')
expect(page).to have_content('Is this GitLab trial for your company?')
end end
context 'enters a valid new group name' do context 'enters a valid new group name' do
...@@ -99,12 +101,14 @@ describe 'Trial Select Namespace', :js do ...@@ -99,12 +101,14 @@ describe 'Trial Select Namespace', :js do
visit select_trials_path visit select_trials_path
wait_for_all_requests wait_for_all_requests
choose :trial_entity_company
select2 user.namespace.id, from: '#namespace_id' select2 user.namespace.id, from: '#namespace_id'
end end
context 'without trial plan' do context 'without trial plan' do
it 'does not show the new group name input' do it 'does not show the new group name input' do
expect(page).not_to have_field('New Group Name') expect(page).not_to have_field('New Group Name')
expect(page).to have_content('Is this GitLab trial for your company?')
end end
it 'applies trial and redirects to dashboard' do it 'applies trial and redirects to dashboard' do
......
...@@ -10470,6 +10470,9 @@ msgstr "" ...@@ -10470,6 +10470,9 @@ msgstr ""
msgid "Is blocked by" msgid "Is blocked by"
msgstr "" msgstr ""
msgid "Is this GitLab trial for your company?"
msgstr ""
msgid "Is using license seat:" msgid "Is using license seat:"
msgstr "" 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