Commit 8b832ed3 authored by Angelo Gulina's avatar Angelo Gulina Committed by Robert Speicher

[CI Minutes] Link to new CI Minutes purchase route

parent 4e282783
......@@ -38,5 +38,11 @@ module EE
current_user.can?(:admin_namespace, namespace.root_ancestor)
end
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)
buy_minutes_subscriptions_path(selected_group: namespace.id)
end
end
end
......@@ -7,7 +7,7 @@
.col-sm-6.offset-sm-6
- if ::Gitlab.com?
= link_to s_('UsageQuota|Buy additional minutes'),
EE::SUBSCRIPTIONS_MORE_MINUTES_URL,
link_to_buy_additional_minutes_path(namespace),
target: '_blank',
class: 'gl-button btn btn-confirm float-right',
data: { track_event: 'click_buy_ci_minutes', track_label: namespace.actual_plan_name, track_property: 'pipeline_quota_page' }
......
......@@ -144,8 +144,6 @@ RSpec.describe 'Groups > Usage Quotas' do
it 'has correct tracking setup and shows correct group quota and projects info' do
visit_pipeline_quota_page
expect(page).to have_link('Buy additional minutes', href: EE::SUBSCRIPTIONS_MORE_MINUTES_URL)
page.within('.pipeline-quota') do
expect(page).to have_content("1000 / 500 minutes")
expect(page).to have_content("200% used")
......@@ -188,6 +186,28 @@ RSpec.describe 'Groups > Usage Quotas' do
end
end
describe 'new_route_ci_minutes_purchase feature flag' do
context 'when is disabled' do
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
end
it 'points to Customers Portal purchase flow' do
visit_pipeline_quota_page
expect(page).to have_link('Buy additional minutes', href: EE::SUBSCRIPTIONS_MORE_MINUTES_URL)
end
end
context 'when is enabled' do
it 'points to GitLab purchase flow' do
visit_pipeline_quota_page
expect(page).to have_link('Buy additional minutes', href: buy_minutes_subscriptions_path(selected_group: group.id))
end
end
end
def visit_pipeline_quota_page
visit group_usage_quotas_path(group)
end
......
......@@ -172,4 +172,24 @@ RSpec.describe EE::NamespacesHelper do
end
end
end
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) }
context 'new_route_ci_minutes_purchase' do
context 'when is disabled' do
before do
stub_feature_flags(new_route_ci_minutes_purchase: false)
end
it { is_expected.to be EE::SUBSCRIPTIONS_MORE_MINUTES_URL }
end
context 'when is enabled' do
it { is_expected.to eq buy_minutes_subscriptions_path(selected_group: namespace.id) }
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