Commit 6092b9b6 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'nicolasdular/record-user-for-terms-experiment' into 'master'

Record terms opt in experiment users

See merge request gitlab-org/gitlab!40950
parents 134ee51f 904d3987
......@@ -26,12 +26,12 @@ class RegistrationsController < Devise::RegistrationsController
end
def create
track_experiment_event(:terms_opt_in, 'end')
accept_pending_invitations
super do |new_user|
persist_accepted_terms_if_required(new_user)
set_role_required(new_user)
track_terms_experiment(new_user)
yield new_user if block_given?
end
......@@ -201,6 +201,13 @@ class RegistrationsController < Devise::RegistrationsController
true
end
def track_terms_experiment(new_user)
return unless new_user.persisted?
track_experiment_event(:terms_opt_in, 'end')
record_experiment_user(:terms_opt_in)
end
def load_recaptcha
Gitlab::Recaptcha.load_configurations!
end
......
......@@ -316,6 +316,12 @@ RSpec.describe RegistrationsController do
stub_experiment(signup_flow: true, terms_opt_in: true)
end
it 'records user for the terms_opt_in experiment' do
expect(controller).to receive(:record_experiment_user).with(:terms_opt_in)
subject
end
context 'when user is not part of the experiment' do
before do
stub_experiment_for_user(signup_flow: true, terms_opt_in: false)
......
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