Commit 1a62267a authored by Dmytro Zaporozhets (DZ)'s avatar Dmytro Zaporozhets (DZ)

Merge branch...

Merge branch '215852-experiment-requiring-a-cohort-of-trial-signups-into-only-group-trials' into 'master'

Experiment: no personal trials, only group trials

See merge request gitlab-org/gitlab!40564
parents 7bae38e0 21fb4065
...@@ -8,6 +8,7 @@ class TrialsController < ApplicationController ...@@ -8,6 +8,7 @@ class TrialsController < ApplicationController
before_action :check_if_gl_com_or_dev before_action :check_if_gl_com_or_dev
before_action :authenticate_user! before_action :authenticate_user!
before_action :find_or_create_namespace, only: :apply before_action :find_or_create_namespace, only: :apply
before_action :record_user_for_group_only_trials_experiment, only: :select
def new def new
end end
...@@ -97,4 +98,8 @@ class TrialsController < ApplicationController ...@@ -97,4 +98,8 @@ class TrialsController < ApplicationController
group group
end end
def record_user_for_group_only_trials_experiment
record_experiment_user(:group_only_trials)
end
end end
...@@ -66,6 +66,8 @@ module EE ...@@ -66,6 +66,8 @@ module EE
end end
def trial_user_namespaces def trial_user_namespaces
return [] if experiment_enabled?(:group_only_trials)
strong_memoize(:trial_user_namespaces) do strong_memoize(:trial_user_namespaces) do
user_namespace = current_user.namespace user_namespace = current_user.namespace
user_namespace.eligible_for_trial? ? [user_namespace] : [] user_namespace.eligible_for_trial? ? [user_namespace] : []
......
...@@ -120,13 +120,43 @@ RSpec.describe TrialsController do ...@@ -120,13 +120,43 @@ RSpec.describe TrialsController do
end end
describe '#select' do describe '#select' do
subject do def get_select
get :select get :select
end
subject do
get_select
response response
end end
it_behaves_like 'an authenticated endpoint' it_behaves_like 'an authenticated endpoint'
it_behaves_like 'a dot-com only feature' 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 end
describe '#apply' do describe '#apply' do
......
...@@ -65,6 +65,9 @@ module Gitlab ...@@ -65,6 +65,9 @@ module Gitlab
}, },
invitation_reminders: { invitation_reminders: {
tracking_category: 'Growth::Acquisition::Experiment::InvitationReminders' tracking_category: 'Growth::Acquisition::Experiment::InvitationReminders'
},
group_only_trials: {
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials'
} }
}.freeze }.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