Commit 41762e28 authored by Doug Stull's avatar Doug Stull

Merge branch '273634-aa-redirect-experiment-project-security-level' into 'master'

Redirect trial user to feature for project security

See merge request gitlab-org/gitlab!67324
parents 019cc163 a8850202
......@@ -190,6 +190,6 @@ class TrialsController < ApplicationController
end
def discover_group_security_flow?
params[:glm_content] == 'discover-group-security'
%w(discover-group-security discover-project-security).include?(params[:glm_content])
end
end
......@@ -184,30 +184,30 @@ RSpec.describe TrialsController do
subject
end
context 'in discover group security flow' do
let(:post_params) { { namespace_id: namespace.id, glm_content: 'discover-group-security' } }
context 'with redirect_trial_user_to_feature experiment variant' do
before do
stub_experiments(redirect_trial_user_to_feature: :candidate)
end
it { is_expected.to redirect_to(group_security_dashboard_url(namespace, { trial: true })) }
it 'records the subject' do
expect(Experiment).to receive(:add_subject).with('redirect_trial_user_to_feature', variant: :experimental, subject: namespace)
context 'redirect trial user to feature' do
using RSpec::Parameterized::TableSyntax
where(:segment, :glm_content, :redirect) do
:control | 'discover-group-security' | :group_url
:candidate | 'discover-group-security' | :group_security_dashboard_url
:control | 'discover-project-security' | :group_url
:candidate | 'discover-project-security' | :group_security_dashboard_url
end
subject
with_them do
let(:post_params) { { namespace_id: namespace.id, glm_content: glm_content } }
let(:variant) { segment == :control ? :control : :experimental }
let(:redirect_url) do
redirect == :group_url ? group_url(namespace, { trial: true }) : group_security_dashboard_url(namespace, { trial: true })
end
end
context 'with redirect_trial_user_to_feature experiment control' do
before do
stub_experiments(redirect_trial_user_to_feature: :control)
stub_experiments(redirect_trial_user_to_feature: segment)
end
it { is_expected.to redirect_to(group_url(namespace, { trial: true })) }
it { is_expected.to redirect_to(redirect_url) }
it 'records the subject' do
expect(Experiment).to receive(:add_subject).with('redirect_trial_user_to_feature', variant: :control, subject: namespace)
expect(Experiment).to receive(:add_subject).with('redirect_trial_user_to_feature', variant: variant, subject: namespace)
subject
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