Commit 21fb4065 authored by Dallas Reedy's avatar Dallas Reedy Committed by Dmytro Zaporozhets (DZ)

Set up experiment for group-only trials

- Remove personal namespaces from the trial namespace selection form
- Add new experiment key for :group_only_trials
- Record the experiment users & some key events
parent 5697b480
......@@ -8,6 +8,7 @@ class TrialsController < ApplicationController
before_action :check_if_gl_com_or_dev
before_action :authenticate_user!
before_action :find_or_create_namespace, only: :apply
before_action :record_user_for_group_only_trials_experiment, only: :select
def new
end
......@@ -97,4 +98,8 @@ class TrialsController < ApplicationController
group
end
def record_user_for_group_only_trials_experiment
record_experiment_user(:group_only_trials)
end
end
......@@ -66,6 +66,8 @@ module EE
end
def trial_user_namespaces
return [] if experiment_enabled?(:group_only_trials)
strong_memoize(:trial_user_namespaces) do
user_namespace = current_user.namespace
user_namespace.eligible_for_trial? ? [user_namespace] : []
......
......@@ -120,13 +120,43 @@ RSpec.describe TrialsController do
end
describe '#select' do
subject do
def get_select
get :select
end
subject do
get_select
response
end
it_behaves_like 'an authenticated endpoint'
it_behaves_like 'a dot-com only feature'
context 'when the group-only trials experiment is active' do
before do
stub_experiment(group_only_trials: true)
stub_experiment_for_user(group_only_trials: user_is_in_experiment?)
end
def expected_group_type
user_is_in_experiment? ? 'experimental' : 'control'
end
where(user_is_in_experiment?: [true, false])
with_them do
it 'records the user as being part of the experiment' do
expect { get_select }.to change { ExperimentUser.count }.by(1)
expect(ExperimentUser.last.group_type).to eq(expected_group_type)
end
end
end
context 'when the group-only trials experiment is not active' do
it 'does not record the user as being part of the experiment' do
expect { get_select }.not_to change { ExperimentUser.count }
end
end
end
describe '#apply' do
......
......@@ -65,6 +65,9 @@ module Gitlab
},
invitation_reminders: {
tracking_category: 'Growth::Acquisition::Experiment::InvitationReminders'
},
group_only_trials: {
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials'
}
}.freeze
......
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