Commit 2fd8985f authored by Douwe Maan's avatar Douwe Maan

Merge branch 'rd-show-additional-minutes-button-only-for-paid-plans' into 'master'

Show button to purchase extra CI minutes only for paid plans

See merge request gitlab-org/gitlab-ee!10628
parents cc517e48 5e150108
...@@ -284,6 +284,10 @@ module EE ...@@ -284,6 +284,10 @@ module EE
actual_plan_name == GOLD_PLAN actual_plan_name == GOLD_PLAN
end end
def paid_plan?
!(free_plan? || early_adopter_plan?)
end
def use_elasticsearch? def use_elasticsearch?
::Gitlab::CurrentSettings.elasticsearch_indexes_namespace?(self) ::Gitlab::CurrentSettings.elasticsearch_indexes_namespace?(self)
end end
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
%strong= @group.name %strong= @group.name
group group
.col-sm-6 - if @group.paid_plan?
%p.text-right .col-sm-6
= link_to 'Buy additional minutes', 'https://customers.gitlab.com/subscriptions', target: '_blank', class: 'btn btn-inverted btn-success right text-right' %p.text-right
= link_to 'Buy additional minutes', 'https://customers.gitlab.com/subscriptions', target: '_blank', class: 'btn btn-inverted btn-success right text-right'
= render "namespaces/pipelines_quota/list", = render "namespaces/pipelines_quota/list",
locals: { namespace: @group, projects: @projects } locals: { namespace: @group, projects: @projects }
...@@ -56,4 +56,36 @@ describe Namespace do ...@@ -56,4 +56,36 @@ describe Namespace do
expect(namespace.use_elasticsearch?).to eq(true) expect(namespace.use_elasticsearch?).to eq(true)
end end
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, :expected_result) do
described_class::FREE_PLAN | false
described_class::EARLY_ADOPTER_PLAN | false
described_class::BRONZE_PLAN | true
described_class::SILVER_PLAN | true
described_class::GOLD_PLAN | true
end
with_them do
before do
namespace.update!(gitlab_subscription_attributes: { hosted_plan: Plan.find_by_name(plan_code) })
end
it do
is_expected.to eq(expected_result)
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