Commit 62cb58cc authored by Dallas Reedy's avatar Dallas Reedy

Record the ExperimentSubject for the Highlight Paid Features experiment

parent 885ebcee
...@@ -10,6 +10,7 @@ module PaidFeatureCalloutHelper ...@@ -10,6 +10,7 @@ module PaidFeatureCalloutHelper
e.exclude! unless group && eligible_for_trial_upgrade_callout?(group) e.exclude! unless group && eligible_for_trial_upgrade_callout?(group)
e.use { nil } # control gets nothing new added to the existing UI e.use { nil } # control gets nothing new added to the existing UI
e.try(&block) e.try(&block)
e.record!
end end
end end
......
...@@ -22,20 +22,35 @@ RSpec.describe PaidFeatureCalloutHelper do ...@@ -22,20 +22,35 @@ RSpec.describe PaidFeatureCalloutHelper do
subject { helper.run_highlight_paid_features_during_active_trial_experiment(group, &candidate_block).run } subject { helper.run_highlight_paid_features_during_active_trial_experiment(group, &candidate_block).run }
context 'when the user is in the candidate' do shared_examples 'records an ExperimentSubject' do
let(:variant) { :candidate } it 'records the group as an ExperimentSubject' do
expect { subject }.to change { ExperimentSubject.count }
end
end
it { is_expected.to eq('in candidate') } shared_examples 'does not record an ExperimentSubject' do
it 'does not record the group as an ExperimentSubject' do
expect { subject }.not_to change { ExperimentSubject.count }
end
end end
shared_examples 'user receives control experience' do shared_examples 'user receives control experience' do
it { is_expected.to be_nil } it { is_expected.to be_nil }
end end
context 'when the user is in the candidate' do
let(:variant) { :candidate }
it { is_expected.to eq('in candidate') }
include_examples 'records an ExperimentSubject'
end
context 'when the user is in the control' do context 'when the user is in the control' do
let(:variant) { :control } let(:variant) { :control }
include_examples 'user receives control experience' include_examples 'user receives control experience'
include_examples 'records an ExperimentSubject'
end end
context 'when the user would be in the candidate' do context 'when the user would be in the candidate' do
...@@ -45,18 +60,21 @@ RSpec.describe PaidFeatureCalloutHelper do ...@@ -45,18 +60,21 @@ RSpec.describe PaidFeatureCalloutHelper do
let(:trials_available) { false } let(:trials_available) { false }
include_examples 'user receives control experience' include_examples 'user receives control experience'
include_examples 'does not record an ExperimentSubject'
end end
context 'but the group is not in an active trial' do context 'but the group is not in an active trial' do
let(:group_has_active_trial) { false } let(:group_has_active_trial) { false }
include_examples 'user receives control experience' include_examples 'user receives control experience'
include_examples 'does not record an ExperimentSubject'
end end
context 'but the user is not an admin of the group' do context 'but the user is not an admin of the group' do
let(:user_can_admin_group) { false } let(:user_can_admin_group) { false }
include_examples 'user receives control experience' include_examples 'user receives control experience'
include_examples 'does not record an ExperimentSubject'
end end
end end
end end
......
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