Commit 63cd4b2f authored by James Lopez's avatar James Lopez

Merge branch 'rd-enable-purchase-ci-minutes-button-for-free-plans' into 'master'

Enable the Buy CI Minutes button for Groups with free or trial plan.

See merge request gitlab-org/gitlab-ee!12255
parents f1b91890 aa3951fe
......@@ -292,12 +292,6 @@ module EE
actual_plan_name == GOLD_PLAN
end
def paid_plan?
return false if trial?
!(free_plan? || early_adopter_plan?)
end
def use_elasticsearch?
::Gitlab::CurrentSettings.elasticsearch_indexes_namespace?(self)
end
......
# frozen_string_literal: true
class FetchSubscriptionPlansService
URL = 'https://customers.gitlab.com/gitlab_plans'.freeze
URL = "#{EE::SUBSCRIPTIONS_URL}/gitlab_plans".freeze
def initialize(plan:)
@plan = plan
......
......@@ -10,10 +10,9 @@
%strong= @group.name
group
- if @group.paid_plan?
.col-sm-6
%p.text-right
= link_to 'Buy additional minutes', 'https://customers.gitlab.com/subscriptions', target: '_blank', class: 'btn btn-inverted btn-success right text-right'
.col-sm-6
%p.text-right
= link_to 'Buy additional minutes', EE::SUBSCRIPTIONS_PLANS_URL, target: '_blank', class: 'btn btn-inverted btn-success right text-right'
= render "namespaces/pipelines_quota/list",
locals: { namespace: @group, projects: @projects }
......@@ -13,7 +13,7 @@
%p.mb-0
%span= _('Try all GitLab has to offer for 30 days.')
%span.d-none.d-sm-inline= _('No credit card required.')
= link_to _('Start your trial'), 'https://customers.gitlab.com/trials/new?gl_com=true', class: "btn btn-primary mt-2 mt-sm-0 #{button_css_class}", target: '_blank'
= link_to _('Start your trial'), "#{EE::SUBSCRIPTIONS_URL}/trials/new?gl_com=true", class: "btn btn-primary mt-2 mt-sm-0 #{button_css_class}", target: '_blank'
- if is_dismissable
%button.btn.btn-default.close.js-close{ type: 'button',
......
......@@ -56,39 +56,4 @@ describe Namespace do
expect(namespace.use_elasticsearch?).to eq(true)
end
end
describe '#paid_plan?' do
using RSpec::Parameterized::TableSyntax
let(:namespace) { create(:namespace) }
before(:all) do
%i[free_plan early_adopter_plan bronze_plan silver_plan gold_plan].each do |plan|
create(plan)
end
end
subject { namespace.paid_plan? }
where(:plan_code, :trial, :expected_result) do
described_class::FREE_PLAN | false | false
described_class::EARLY_ADOPTER_PLAN | false | false
described_class::BRONZE_PLAN | false | true
described_class::SILVER_PLAN | false | true
described_class::GOLD_PLAN | false | true
described_class::BRONZE_PLAN | true | false
described_class::SILVER_PLAN | true | false
described_class::GOLD_PLAN | true | false
end
with_them do
before do
namespace.update!(gitlab_subscription_attributes: { trial: trial, hosted_plan: Plan.find_by_name(plan_code) })
end
it do
is_expected.to eq(expected_result)
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