Commit ac2438d9 authored by Krasimir Angelov's avatar Krasimir Angelov

Fix subscription banner on New Project page

Do not try to find `closest_gitlab_subscription` for projects that are
not persisted yet.

Fixes https://gitlab.com/gitlab-org/gitlab/-/issues/322546.
parent 8d0ec9fb
......@@ -58,7 +58,9 @@ module EE
def decorated_subscription
entity = @project || @group
subscription = entity&.closest_gitlab_subscription
return unless entity && entity.persisted?
subscription = entity.closest_gitlab_subscription
return unless subscription
......
---
title: Fix subscription banner on New Project page
merge_request: 56443
author:
type: fixed
......@@ -3,6 +3,21 @@
require 'spec_helper'
RSpec.describe EE::SubscribableBannerHelper do
describe '#renew_subscription_path' do
it 'does not raise error if available project is not persisted' do
assign(:project, Project.new)
expect { helper.renew_subscription_path }.not_to raise_error
end
it 'does not raise error if entity is not available' do
assign(:project, nil)
assign(:group, nil)
expect { helper.renew_subscription_path }.not_to raise_error
end
end
describe '#gitlab_subscription_or_license' do
subject { helper.gitlab_subscription_or_license }
......
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