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
actual_plan_name == GOLD_PLAN
end
def paid_plan?
!(free_plan? || early_adopter_plan?)
end
def use_elasticsearch?
::Gitlab::CurrentSettings.elasticsearch_indexes_namespace?(self)
end
......
......@@ -10,6 +10,7 @@
%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'
......
......@@ -56,4 +56,36 @@ 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, :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
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