Commit 2405d955 authored by Illya Klymov's avatar Illya Klymov

Merge branch...

Merge branch '238191-hide-the-upgrade-link-on-the-admin-license-page-if-the-current-plan-is-ultimate' into 'master'

Hide the upgrade link on the admin license page if plan Ultimate

Closes #238191

See merge request gitlab-org/gitlab!40977
parents 45b8fcdc 7434421c
......@@ -439,10 +439,12 @@ class License < ApplicationRecord
restricted_attr(:trial)
end
def exclude_guests_from_active_count?
def ultimate?
plan == License::ULTIMATE_PLAN
end
alias_method :exclude_guests_from_active_count?, :ultimate?
def remaining_days
return 0 if expired?
......
......@@ -16,6 +16,7 @@
%li
%span.light= _('Plan:')
%strong= @license.plan.capitalize
- unless @license.ultimate?
= ' - '
= link_to _('How to upgrade'),
help_page_path('subscriptions/index.md', anchor: 'upgrade-your-self-managed-subscription-tier'),
......
---
title: Hide the upgrade link on the admin license page if plan Ultimate
merge_request: 40977
author:
type: changed
......@@ -767,6 +767,26 @@ RSpec.describe License do
end
end
describe '#ultimate?' do
using RSpec::Parameterized::TableSyntax
let(:license) { build(:license, plan: plan) }
subject { license.ultimate? }
where(:plan, :expected) do
nil | false
described_class::STARTER_PLAN | false
described_class::PREMIUM_PLAN | false
described_class::EARLY_ADOPTER_PLAN | false
described_class::ULTIMATE_PLAN | true
end
with_them do
it { is_expected.to eq(expected) }
end
end
describe 'Trial Licenses' do
before do
ApplicationSetting.create_from_defaults
......
......@@ -3,13 +3,14 @@
require 'spec_helper'
RSpec.describe 'admin/licenses/_info' do
let_it_be(:license) { create(:license) }
context 'when observing the license' do
before do
assign(:license, license)
end
context 'when observing licensees' do
context 'when plan can be upgraded' do
let(:license) { create(:license, plan: License::STARTER_PLAN) }
it 'shows "How to upgrade" link' do
render
......@@ -17,4 +18,16 @@ RSpec.describe 'admin/licenses/_info' do
expect(rendered).to have_link('How to upgrade')
end
end
context 'when plan can not be upgraded' do
let(:license) { create(:license, plan: License::ULTIMATE_PLAN) }
it 'does not show "How to upgrade" link' do
render
expect(rendered).to have_content('Plan: Ultimate')
expect(rendered).not_to have_link('How to upgrade')
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