Commit c9fece74 authored by Alper Akgun's avatar Alper Akgun

Add a context for experiment recording

for "Remove known fields from trial sign up form" growth experiment
parent 90f18823
......@@ -13,7 +13,7 @@ class TrialsController < ApplicationController
feature_category :purchase
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)
end
......@@ -115,4 +115,12 @@ class TrialsController < ApplicationController
def record_user_for_group_only_trials_experiment
record_experiment_user(:group_only_trials)
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
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe TrialsController do
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?,
last_name_present: user.last_name.present?,
......@@ -55,7 +55,7 @@ RSpec.describe TrialsController do
end
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)
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