Commit dd98e01e authored by Alper Akgun's avatar Alper Akgun

Merge branch '234013-context-for-remove-known-fields-from-trial-sign-up-form' into 'master'

Add a context for "Remove known fields from trial sign up form"

See merge request gitlab-org/gitlab!49210
parents e50538f4 c9fece74
...@@ -13,7 +13,7 @@ class TrialsController < ApplicationController ...@@ -13,7 +13,7 @@ class TrialsController < ApplicationController
feature_category :purchase feature_category :purchase
def new def new
record_experiment_user(:remove_known_trial_form_fields) record_experiment_user(:remove_known_trial_form_fields, remove_known_trial_form_fields_context)
record_experiment_user(:trimmed_skip_trial_copy) record_experiment_user(:trimmed_skip_trial_copy)
end end
...@@ -115,4 +115,12 @@ class TrialsController < ApplicationController ...@@ -115,4 +115,12 @@ class TrialsController < ApplicationController
def record_user_for_group_only_trials_experiment def record_user_for_group_only_trials_experiment
record_experiment_user(:group_only_trials) record_experiment_user(:group_only_trials)
end end
def remove_known_trial_form_fields_context
{
first_name_present: current_user.first_name.present?,
last_name_present: current_user.last_name.present?,
company_name_present: current_user.organization.present?
}
end
end end
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe TrialsController do RSpec.describe TrialsController do
let_it_be(:user) { create(:user, email_opted_in: true, last_name: 'Doe') } let_it_be(:user) { create(:user, email_opted_in: true, last_name: 'Doe') }
let_it_be(:experiment_user_context) do let_it_be(:remove_known_trial_form_fields_context) do
{ {
first_name_present: user.first_name.present?, first_name_present: user.first_name.present?,
last_name_present: user.last_name.present?, last_name_present: user.last_name.present?,
...@@ -55,7 +55,7 @@ RSpec.describe TrialsController do ...@@ -55,7 +55,7 @@ RSpec.describe TrialsController do
end end
it 'calls record_experiment_user for the remove_known_trial_form_fields & trimmed_skip_trial_copy experiments' do it 'calls record_experiment_user for the remove_known_trial_form_fields & trimmed_skip_trial_copy experiments' do
expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields) expect(controller).to receive(:record_experiment_user).with(:remove_known_trial_form_fields, remove_known_trial_form_fields_context)
expect(controller).to receive(:record_experiment_user).with(:trimmed_skip_trial_copy) expect(controller).to receive(:record_experiment_user).with(:trimmed_skip_trial_copy)
subject subject
......
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