Commit 55b4480a authored by Max Woolf's avatar Max Woolf

Merge branch 'vij-remove-subscribable-banner-flag' into 'master'

Remove subscribable_subscription_banner flag

See merge request gitlab-org/gitlab!68257
parents 2d99203c 35f3121f
......@@ -73,9 +73,7 @@ module EE
end
def display_subscription_banner?
@display_subscription_banner &&
::Gitlab::CurrentSettings.should_check_namespace_plan? &&
::Feature.enabled?(:subscribable_subscription_banner, default_enabled: false)
@display_subscription_banner && ::Gitlab::CurrentSettings.should_check_namespace_plan?
end
end
end
---
name: subscribable_subscription_banner
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31497
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/230858
milestone: '13.1'
type: development
group: group::utilization
default_enabled: false
......@@ -107,115 +107,96 @@ RSpec.describe EE::SubscribableBannerHelper do
let(:message) { double(:message) }
context 'when subscribable_subscription_banner feature flag is enabled' do
context 'when instance variable true' do
before do
stub_feature_flags(subscribable_subscription_banner: true)
assign(:display_subscription_banner, true)
end
context 'when instance variable true' do
context 'when should_check_namespace_plan is true' do
before do
assign(:display_subscription_banner, true)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
end
context 'when should_check_namespace_plan is true' do
before do
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
end
let(:gitlab_subscription) { entity.closest_gitlab_subscription }
let(:decorated_mock) { double(:decorated_mock) }
let(:message_mock) { double(:message_mock) }
let(:user) { double(:user_mock) }
shared_examples 'subscription message' do
it 'calls Gitlab::ExpiringSubscriptionMessage and SubscriptionPresenter if is Gitlab.com?' do
allow(helper).to receive(:signed_in?).and_return(true)
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:can?).with(user, :owner_access, root_namespace).and_return(true)
expect(SubscriptionPresenter).to receive(:new).with(gitlab_subscription).and_return(decorated_mock)
expect(::Gitlab::ExpiringSubscriptionMessage).to receive(:new).with(
subscribable: decorated_mock,
signed_in: true,
is_admin: true,
namespace: namespace
).and_return(message_mock)
expect(message_mock).to receive(:message).and_return('hey yay yay yay')
expect(subject).to eq('hey yay yay yay')
end
end
let(:root_namespace) { create(:group_with_plan) }
let(:namespace) { create(:group, :nested, parent: root_namespace) }
let(:gitlab_subscription) { entity.closest_gitlab_subscription }
let(:decorated_mock) { double(:decorated_mock) }
let(:message_mock) { double(:message_mock) }
let(:user) { double(:user_mock) }
context 'when a project is present' do
let(:entity) { create(:project, namespace: namespace) }
shared_examples 'subscription message' do
it 'calls Gitlab::ExpiringSubscriptionMessage and SubscriptionPresenter if is Gitlab.com?' do
allow(helper).to receive(:signed_in?).and_return(true)
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:can?).with(user, :owner_access, root_namespace).and_return(true)
before do
assign(:project, entity)
end
expect(SubscriptionPresenter).to receive(:new).with(gitlab_subscription).and_return(decorated_mock)
expect(::Gitlab::ExpiringSubscriptionMessage).to receive(:new).with(
subscribable: decorated_mock,
signed_in: true,
is_admin: true,
namespace: namespace
).and_return(message_mock)
expect(message_mock).to receive(:message).and_return('hey yay yay yay')
it_behaves_like 'subscription message'
expect(subject).to eq('hey yay yay yay')
end
end
context 'when a group is present' do
let(:entity) { namespace }
let(:root_namespace) { create(:group_with_plan) }
let(:namespace) { create(:group, :nested, parent: root_namespace) }
before do
assign(:project, nil)
assign(:group, entity)
end
context 'when a project is present' do
let(:entity) { create(:project, namespace: namespace) }
it_behaves_like 'subscription message'
before do
assign(:project, entity)
end
it_behaves_like 'subscription message'
end
context 'when should_check_namespace_plan is false' do
let(:license) { double(:license) }
let(:message_mock) { double(:message_mock) }
let(:user) { double(:user) }
context 'when a group is present' do
let(:entity) { namespace }
before do
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(false)
allow(License).to receive(:current).and_return(license)
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:signed_in?).and_return(true)
allow(user).to receive(:admin?).and_return(false)
assign(:project, nil)
assign(:group, entity)
end
it 'calls Gitlab::ExpiringSubscriptionMessage to get expiring message' do
expect(Gitlab::ExpiringSubscriptionMessage).to receive(:new).with(
subscribable: license,
signed_in: true,
is_admin: false,
force_notification: false
).and_return(message_mock)
expect(message_mock).to receive(:message)
subject
end
it_behaves_like 'subscription message'
end
end
context 'when instance variable false' do
context 'when should_check_namespace_plan is false' do
let(:license) { double(:license) }
let(:message_mock) { double(:message_mock) }
let(:user) { double(:user) }
before do
assign(:display_subscription_banner, false)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(false)
allow(License).to receive(:current).and_return(license)
allow(helper).to receive(:current_user).and_return(user)
allow(helper).to receive(:signed_in?).and_return(true)
allow(user).to receive(:admin?).and_return(false)
end
it 'returns the license message' do
expect(helper).to receive(:license_message).and_return(message)
expect(subject).to eq(message)
it 'calls Gitlab::ExpiringSubscriptionMessage to get expiring message' do
expect(Gitlab::ExpiringSubscriptionMessage).to receive(:new).with(
subscribable: license,
signed_in: true,
is_admin: false,
force_notification: false
).and_return(message_mock)
expect(message_mock).to receive(:message)
subject
end
end
end
context 'when subscribable_subscription_banner feature flag is disabled' do
context 'when instance variable false' do
before do
stub_feature_flags(subscribable_subscription_banner: false)
assign(:display_subscription_banner, true)
assign(:display_subscription_banner, false)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
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