Skip to content
Snippets Groups Projects
Verified Commit 3a1c8031 authored by Angelo Gulina's avatar Angelo Gulina :four: Committed by GitLab
Browse files

Update specs for #show_active_user_count_threshold_banner?

parent d9182531
No related branches found
No related tags found
1 merge request!171512Update specs for #show_active_user_count_threshold_banner?
......@@ -8,10 +8,6 @@
let(:user) { build_stubbed(:user) }
let(:license) { build_stubbed(:gitlab_license) }
before do
stub_feature_flags(sm_seat_control_block_overages: false)
end
describe '#show_active_user_count_threshold_banner?' do
subject { helper.show_active_user_count_threshold_banner? }
......@@ -50,9 +46,67 @@
.and_return(license_active_user_count_threshold_reached)
allow(License).to receive(:current).and_return(license)
end
stub_feature_flags(sm_seat_control_block_overages: false)
end
it { is_expected.to be should_render }
context "when sm_seat_control_block_overages is enabled" do
before do
stub_feature_flags(sm_seat_control_block_overages: true)
end
it { is_expected.to be_nil }
end
end
end
describe '#show_block_seat_overages_user_count_banner?' do
subject { helper.show_block_seat_overages_user_count_banner? }
where(
:dot_com,
:admin_section,
:license_nil,
:user_can_admin_all_resources,
:license_active_user_count_threshold_reached,
:should_render
) do
false | true | false | true | true | true # Happy Path
true | true | false | true | true | nil # ::Gitlab.com? is true
false | false | false | true | true | nil # admin_section is false
false | true | true | true | true | nil # license is nil
false | true | false | false | true | false # user_can_admin_all_resources is false
false | true | false | true | false | false # license_active_user_count_threshold_reached is false
end
with_them do
before do
allow(Gitlab).to receive(:com?).and_return(dot_com)
allow(helper).to receive(:admin_section?).and_return(admin_section)
allow(user).to receive(:can_admin_all_resources?).and_return(user_can_admin_all_resources)
allow(helper).to receive(:current_user).and_return(user)
if license_nil
allow(License).to receive(:current).and_return(nil)
else
allow(license).to receive(:active_user_count_threshold_reached?)
.and_return(license_active_user_count_threshold_reached)
allow(License).to receive(:current).and_return(license)
end
end
it { is_expected.to be should_render }
context "when sm_seat_control_block_overages is disabled" do
before do
stub_feature_flags(sm_seat_control_block_overages: false)
end
it { is_expected.to be_nil }
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment