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 ...@@ -73,9 +73,7 @@ module EE
end end
def display_subscription_banner? def display_subscription_banner?
@display_subscription_banner && @display_subscription_banner && ::Gitlab::CurrentSettings.should_check_namespace_plan?
::Gitlab::CurrentSettings.should_check_namespace_plan? &&
::Feature.enabled?(:subscribable_subscription_banner, default_enabled: false)
end end
end 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 ...@@ -107,115 +107,96 @@ RSpec.describe EE::SubscribableBannerHelper do
let(:message) { double(:message) } let(:message) { double(:message) }
context 'when subscribable_subscription_banner feature flag is enabled' do context 'when instance variable true' do
before do before do
stub_feature_flags(subscribable_subscription_banner: true) assign(:display_subscription_banner, true)
end end
context 'when instance variable true' do context 'when should_check_namespace_plan is true' do
before do before do
assign(:display_subscription_banner, true) allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
end end
context 'when should_check_namespace_plan is true' do let(:gitlab_subscription) { entity.closest_gitlab_subscription }
before do let(:decorated_mock) { double(:decorated_mock) }
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true) let(:message_mock) { double(:message_mock) }
end let(:user) { double(:user_mock) }
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) }
context 'when a project is present' do shared_examples 'subscription message' do
let(:entity) { create(:project, namespace: namespace) } 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 expect(SubscriptionPresenter).to receive(:new).with(gitlab_subscription).and_return(decorated_mock)
assign(:project, entity) expect(::Gitlab::ExpiringSubscriptionMessage).to receive(:new).with(
end 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
end
context 'when a group is present' do let(:root_namespace) { create(:group_with_plan) }
let(:entity) { namespace } let(:namespace) { create(:group, :nested, parent: root_namespace) }
before do context 'when a project is present' do
assign(:project, nil) let(:entity) { create(:project, namespace: namespace) }
assign(:group, entity)
end
it_behaves_like 'subscription message' before do
assign(:project, entity)
end end
it_behaves_like 'subscription message'
end end
context 'when should_check_namespace_plan is false' do context 'when a group is present' do
let(:license) { double(:license) } let(:entity) { namespace }
let(:message_mock) { double(:message_mock) }
let(:user) { double(:user) }
before do before do
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(false) assign(:project, nil)
allow(License).to receive(:current).and_return(license) assign(:group, entity)
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 end
it 'calls Gitlab::ExpiringSubscriptionMessage to get expiring message' do it_behaves_like 'subscription message'
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
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 before do
assign(:display_subscription_banner, false) allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(false)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true) 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 end
it 'returns the license message' do it 'calls Gitlab::ExpiringSubscriptionMessage to get expiring message' do
expect(helper).to receive(:license_message).and_return(message) expect(Gitlab::ExpiringSubscriptionMessage).to receive(:new).with(
expect(subject).to eq(message) 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 end
end end
context 'when subscribable_subscription_banner feature flag is disabled' do context 'when instance variable false' do
before do before do
stub_feature_flags(subscribable_subscription_banner: false) assign(:display_subscription_banner, false)
assign(:display_subscription_banner, true)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true) allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
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