Commit 2219ee57 authored by Angelo Gulina's avatar Angelo Gulina

Simplify subscriptions helper API

Merge methods into one
parent 72536fab
......@@ -17,15 +17,10 @@ module SubscriptionsHelper
end
def buy_addon_data(group, anchor, purchased_product)
{
redirect_after_success: group_usage_quotas_path(group, anchor: anchor, purchased_product: purchased_product)
}.merge(addon_data(group))
end
def addon_data(group)
{
group_data: [present_group(group)].to_json,
namespace_id: params[:selected_group],
redirect_after_success: group_usage_quotas_path(group, anchor: anchor, purchased_product: purchased_product),
source: params[:source]
}
end
......
- page_title _('Buy CI Minutes')
#js-buy-minutes{ data: buy_addon_data(@group, 'pipelines-quota-tab', _('CI minutes')) }
#js-buy-minutes{ data: buy_addon_data(@group, 'pipelines-quota-tab', _('Checkout|CI minutes')) }
......@@ -133,23 +133,6 @@ RSpec.describe SubscriptionsHelper do
end
end
describe '#addon_data' do
subject(:addon_data) { helper.addon_data(group) }
let_it_be(:user) { create(:user, name: 'First Last') }
let_it_be(:group) { create(:group, name: 'My Namespace') }
before do
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:params).and_return({ selected_group: group.id.to_s, source: 'some_source' })
group.add_owner(user)
end
it { is_expected.to include(namespace_id: group.id.to_s) }
it { is_expected.to include(source: 'some_source') }
it { is_expected.to include(group_data: %Q{[{"id":#{group.id},"name":"My Namespace","users":1,"guests":0}]}) }
end
describe '#buy_addon_data' do
subject(:buy_addon_data) { helper.buy_addon_data(group, anchor, purchased_product) }
......
......@@ -5974,9 +5974,6 @@ msgstr ""
msgid "CI configuration validated, including all configuration added with the %{codeStart}includes%{codeEnd} keyword. %{link}"
msgstr ""
msgid "CI minutes"
msgstr ""
msgid "CI settings"
msgstr ""
......@@ -6649,6 +6646,9 @@ msgstr ""
msgid "Checkout|CI minute packs are only used after you've used your subscription's monthly quota. The additional minutes will roll over month to month and are valid for one year."
msgstr ""
msgid "Checkout|CI minutes"
msgstr ""
msgid "Checkout|Checkout"
msgstr ""
......
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