Commit bc7d9ce2 authored by Aishwarya Subramanian's avatar Aishwarya Subramanian Committed by James Lopez

Handling new trials redirect when feature is off

parent 6c37e8a5
......@@ -41,6 +41,8 @@ class TrialRegistrationsController < RegistrationsController
end
def check_if_improved_trials_enabled
render_404 unless Feature.enabled?(:improved_trial_signup)
unless Feature.enabled?(:improved_trial_signup)
redirect_to("#{EE::SUBSCRIPTIONS_URL}/trials/new?gl_com=true")
end
end
end
......@@ -3,6 +3,24 @@
require 'spec_helper'
describe TrialRegistrationsController do
describe '#new' do
before do
allow(Gitlab).to receive(:com?).and_return(true)
end
context 'when feature is turned off' do
before do
stub_feature_flags(improved_trial_signup: false)
end
it 'redirects to subscription portal trial url' do
get :new
expect(response).to redirect_to("#{EE::SUBSCRIPTIONS_URL}/trials/new?gl_com=true")
end
end
end
describe '#create' do
before do
stub_feature_flags(invisible_captcha: false)
......@@ -40,7 +58,7 @@ describe TrialRegistrationsController do
it 'returns not found' do
post :create, params: { user: user_params }
expect(response.status).to eq(404)
expect(response).to redirect_to("#{EE::SUBSCRIPTIONS_URL}/trials/new?gl_com=true")
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