Commit 0f763bf8 authored by David Kim's avatar David Kim

Merge branch '337174-ci-minutes-feature-flag-add-support-for-group-actors' into 'master'

[Ci Minutes] [Feature flag] Add support for group actors

See merge request gitlab-org/gitlab!67120
parents e04f9dd9 c5db2d49
...@@ -32,11 +32,11 @@ class SubscriptionsController < ApplicationController ...@@ -32,11 +32,11 @@ class SubscriptionsController < ApplicationController
end end
def buy_minutes def buy_minutes
return render_404 unless Feature.enabled?(:new_route_ci_minutes_purchase, default_enabled: :yaml)
@group = find_group @group = find_group
return render_404 if @group.nil? return render_404 if @group.nil?
render_404 unless Feature.enabled?(:new_route_ci_minutes_purchase, @group, default_enabled: :yaml)
end end
def payment_form def payment_form
......
...@@ -40,7 +40,7 @@ module EE ...@@ -40,7 +40,7 @@ module EE
end end
def link_to_buy_additional_minutes_path(namespace) def link_to_buy_additional_minutes_path(namespace)
return EE::SUBSCRIPTIONS_MORE_MINUTES_URL if ::Feature.disabled?(:new_route_ci_minutes_purchase, default_enabled: :yaml) return EE::SUBSCRIPTIONS_MORE_MINUTES_URL if ::Feature.disabled?(:new_route_ci_minutes_purchase, namespace, default_enabled: :yaml)
buy_minutes_subscriptions_path(selected_group: namespace.id) buy_minutes_subscriptions_path(selected_group: namespace.id)
end end
......
...@@ -72,7 +72,8 @@ RSpec.describe SubscriptionsController do ...@@ -72,7 +72,8 @@ RSpec.describe SubscriptionsController do
context 'with authenticated user' do context 'with authenticated user' do
before do before do
group.add_owner(user) group.add_owner(user)
stub_feature_flags(new_route_ci_minutes_purchase: true) stub_feature_flags(new_route_ci_minutes_purchase: false)
stub_feature_flags(new_route_ci_minutes_purchase: group)
sign_in(user) sign_in(user)
end end
......
...@@ -190,6 +190,24 @@ RSpec.describe EE::NamespacesHelper do ...@@ -190,6 +190,24 @@ RSpec.describe EE::NamespacesHelper do
context 'when is enabled' do context 'when is enabled' do
it { is_expected.to eq buy_minutes_subscriptions_path(selected_group: namespace.id) } it { is_expected.to eq buy_minutes_subscriptions_path(selected_group: namespace.id) }
end 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) }
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
stub_feature_flags(new_route_ci_minutes_purchase: enabled_namespace)
end
it 'returns the default purchase path for the disabled namespace' do
expect(helper.link_to_buy_additional_minutes_path(disabled_namespace)).to be EE::SUBSCRIPTIONS_MORE_MINUTES_URL
end
it 'returns GitLab purchase path for the disabled namespace' do
expect(helper.link_to_buy_additional_minutes_path(enabled_namespace)).to eq buy_minutes_subscriptions_path(selected_group: enabled_namespace.id)
end
end
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