Commit be326b7f authored by Krasimir Angelov's avatar Krasimir Angelov

Remove not existing feature flag from tests

Tests for `EE::SubscribableBannerHelper` were testing against feature
flag that do not exists (`subscribable_banner`). Remove this flag from
tests, and add some tests for when `subscribable_subscription_banner` is
enabled/disabled.

See https://gitlab.com/gitlab-org/gitlab/-/issues/295308.
parent e9245077
......@@ -16,60 +16,42 @@ RSpec.describe EE::SubscribableBannerHelper do
end
end
context 'when feature flag is enabled' do
let(:license) { double(:license) }
let(:license) { double(:license) }
context 'when instance variable true' do
before do
stub_feature_flags(subscribable_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
context 'when a project exists' do
let(:entity) { create(:project) }
before do
assign(:project, entity)
end
context 'when a project exists' do
let(:entity) { create(:project) }
it_behaves_like 'when a subscription exists'
before do
assign(:project, entity)
end
context 'when a group exists' do
let(:entity) { create(:group) }
before do
assign(:group, entity)
end
it_behaves_like 'when a subscription exists'
end
it_behaves_like 'when a subscription exists'
end
context 'when should_check_namespace_plan is false' do
context 'when a group exists' do
let(:entity) { create(:group) }
before do
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(false)
assign(:group, entity)
end
it 'returns the current license' do
expect(License).to receive(:current).and_return(license)
expect(subject).to eq(license)
end
it_behaves_like 'when a subscription exists'
end
end
context 'when instance variable false' do
context 'when should_check_namespace_plan is false' do
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)
end
it 'returns the current license' do
......@@ -77,18 +59,30 @@ RSpec.describe EE::SubscribableBannerHelper do
expect(subject).to eq(license)
end
end
end
context 'with a future dated license' do
let(:gl_license) { build(:gitlab_license, starts_at: Date.current + 1.month) }
context 'when instance variable false' do
before do
assign(:display_subscription_banner, false)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
end
before do
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
end
it 'returns the current license' do
expect(License).to receive(:current).and_return(license)
expect(subject).to eq(license)
end
end
it 'returns the current license' do
allow(License).to receive(:current).and_return(license)
expect(subject).to eq(license)
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
......@@ -98,9 +92,9 @@ RSpec.describe EE::SubscribableBannerHelper do
let(:message) { double(:message) }
context 'when feature flag is enabled' do
context 'when subscribable_subscription_banner feature flag is enabled' do
before do
stub_feature_flags(subscribable_banner: true)
stub_feature_flags(subscribable_subscription_banner: true)
end
context 'when instance variable true' do
......@@ -201,6 +195,19 @@ RSpec.describe EE::SubscribableBannerHelper do
end
end
end
context 'when subscribable_subscription_banner feature flag is disabled' do
before do
stub_feature_flags(subscribable_subscription_banner: false)
assign(:display_subscription_banner, true)
allow(::Gitlab::CurrentSettings).to receive(:should_check_namespace_plan?).and_return(true)
end
it 'returns the license message' do
expect(helper).to receive(:license_message).and_return(message)
expect(subject).to eq(message)
end
end
end
describe '#display_subscription_banner!' do
......
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