Commit 5cae1278 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'dz/338724-reroute-ci-minutes-purchase' into 'master'

Reroute CI Minutes purchase for personal namespace

See merge request gitlab-org/gitlab!68541
parents 9a5456ab 3d637bf0
......@@ -40,7 +40,8 @@ module EE
end
def link_to_buy_additional_minutes_path(namespace)
return EE::SUBSCRIPTIONS_MORE_MINUTES_URL if ::Feature.disabled?(:new_route_ci_minutes_purchase, namespace, default_enabled: :yaml)
use_customer_dot_path = namespace.user? || ::Feature.disabled?(:new_route_ci_minutes_purchase, namespace, default_enabled: :yaml)
return EE::SUBSCRIPTIONS_MORE_MINUTES_URL if use_customer_dot_path
buy_minutes_subscriptions_path(selected_group: namespace.id)
end
......
......@@ -177,7 +177,7 @@ RSpec.describe EE::NamespacesHelper do
describe '#link_to_buy_additional_minutes_path' do
subject { helper.link_to_buy_additional_minutes_path(namespace) }
let_it_be(:namespace) { create(:namespace_with_plan) }
let_it_be(:namespace) { create(:group) }
context 'new_route_ci_minutes_purchase' do
context 'when is disabled' do
......@@ -193,8 +193,8 @@ RSpec.describe EE::NamespacesHelper do
end
context 'when is enabled only for a specific namespace' do
let_it_be(:enabled_namespace) { create(:namespace_with_plan) }
let_it_be(:disabled_namespace) { create(:namespace_with_plan) }
let_it_be(:enabled_namespace) { create(:group) }
let_it_be(:disabled_namespace) { create(:group) }
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
......@@ -209,6 +209,15 @@ RSpec.describe EE::NamespacesHelper do
expect(helper.link_to_buy_additional_minutes_path(enabled_namespace)).to eq buy_minutes_subscriptions_path(selected_group: enabled_namespace.id)
end
end
context 'when called for a personal namespace' do
let_it_be(:user) { create(:user) }
let_it_be(:personal_namespace) { user.namespace }
it 'returns the default purchase' do
expect(helper.link_to_buy_additional_minutes_path(personal_namespace)).to be EE::SUBSCRIPTIONS_MORE_MINUTES_URL
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