Commit 7db0da5a authored by Sean McGivern's avatar Sean McGivern

Merge branch 'banner-future-date-license' into 'master'

Do not display renewal banner if future dated license is applied

See merge request gitlab-org/gitlab!48283
parents bcfa3c12 d7c014dc
---
title: 'Do not display renewal banner if future dated license is applied'
merge_request: 48283
author:
type: changed
...@@ -120,7 +120,7 @@ module Gitlab ...@@ -120,7 +120,7 @@ module Gitlab
end end
def require_notification? def require_notification?
return false if expiring_auto_renew? return false if expiring_auto_renew? || ::License.future_dated.present?
auto_renew_choice_exists? && expired_subscribable_within_notification_window? auto_renew_choice_exists? && expired_subscribable_within_notification_window?
end end
......
...@@ -77,6 +77,19 @@ RSpec.describe EE::SubscribableBannerHelper do ...@@ -77,6 +77,19 @@ RSpec.describe EE::SubscribableBannerHelper do
expect(subject).to eq(license) expect(subject).to eq(license)
end end
end end
context 'with a future dated license' do
let(:gl_license) { build(:gitlab_license, starts_at: Date.current + 1.month) }
before do
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
end
it 'returns the current license' do
allow(License).to receive(:current).and_return(license)
expect(subject).to eq(license)
end
end
end end
end end
......
...@@ -162,6 +162,16 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do ...@@ -162,6 +162,16 @@ RSpec.describe Gitlab::ExpiringSubscriptionMessage do
end end
end end
context 'when a future dated license is applied' do
before do
create(:license, created_at: Time.current, data: build(:gitlab_license, starts_at: expired_date, expires_at: Date.current + 13.months).export)
end
it 'returns nil' do
expect(subject).to be nil
end
end
context 'with namespace' do context 'with namespace' do
let(:namespace) { double(:namespace, name: 'No Limit Records') } let(:namespace) { double(:namespace, name: 'No Limit Records') }
......
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