diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/helpers/form_helper_spec.rb | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) | |
download | gitlab-ce-15.9.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/helpers/form_helper_spec.rb')
-rw-r--r-- | spec/helpers/form_helper_spec.rb | 83 |
1 files changed, 18 insertions, 65 deletions
diff --git a/spec/helpers/form_helper_spec.rb b/spec/helpers/form_helper_spec.rb index 7c8c59be409..83b08e5fcec 100644 --- a/spec/helpers/form_helper_spec.rb +++ b/spec/helpers/form_helper_spec.rb @@ -6,38 +6,15 @@ RSpec.describe FormHelper do include Devise::Test::ControllerHelpers describe '#dropdown_max_select' do - let(:feature_flag) { :limit_reviewer_and_assignee_size } - - context "with the :limit_reviewer_and_assignee_size feature flag on" do - before do - stub_feature_flags(feature_flag => true) - end - - it 'correctly returns the max amount of reviewers or assignees to allow' do - max = Issuable::MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS - - expect(helper.dropdown_max_select({}, feature_flag)) - .to eq(max) - expect(helper.dropdown_max_select({ 'max-select'.to_sym => 5 }, feature_flag)) - .to eq(5) - expect(helper.dropdown_max_select({ 'max-select'.to_sym => max + 5 }, feature_flag)) - .to eq(max) - end - end - - context "with the :limit_reviewer_and_assignee_size feature flag off" do - before do - stub_feature_flags(feature_flag => false) - end - - it 'correctly returns the max amount of reviewers or assignees to allow' do - expect(helper.dropdown_max_select({}, feature_flag)) - .to eq(nil) - expect(helper.dropdown_max_select({ 'max-select'.to_sym => 5 }, feature_flag)) - .to eq(5) - expect(helper.dropdown_max_select({ 'max-select'.to_sym => 120 }, feature_flag)) - .to eq(120) - end + it 'correctly returns the max amount of reviewers or assignees to allow' do + max = Issuable::MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS + + expect(helper.dropdown_max_select({})) + .to eq(max) + expect(helper.dropdown_max_select({ 'max-select'.to_sym => 5 })) + .to eq(5) + expect(helper.dropdown_max_select({ 'max-select'.to_sym => max + 5 })) + .to eq(max) end end @@ -64,43 +41,19 @@ RSpec.describe FormHelper do describe '#reviewers_dropdown_options' do let(:merge_request) { build(:merge_request) } - context "with the :limit_reviewer_and_assignee_size feature flag on" do - context "with multiple reviewers" do - it 'correctly returns the max amount of reviewers or assignees to allow' do - allow(helper).to receive(:merge_request_supports_multiple_reviewers?).and_return(true) - - expect(helper.reviewers_dropdown_options(merge_request)[:data][:'max-select']) - .to eq(Issuable::MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS) - end - end + context "with multiple reviewers" do + it 'correctly returns the max amount of reviewers or assignees to allow' do + allow(helper).to receive(:merge_request_supports_multiple_reviewers?).and_return(true) - context "with only 1 reviewer" do - it 'correctly returns the max amount of reviewers or assignees to allow' do - expect(helper.reviewers_dropdown_options(merge_request)[:data][:'max-select']) - .to eq(1) - end + expect(helper.reviewers_dropdown_options(merge_request)[:data][:'max-select']) + .to eq(Issuable::MAX_NUMBER_OF_ASSIGNEES_OR_REVIEWERS) end end - context "with the :limit_reviewer_and_assignee_size feature flag off" do - before do - stub_feature_flags(limit_reviewer_and_assignee_size: false) - end - - context "with multiple reviewers" do - it 'correctly returns the max amount of reviewers or assignees to allow' do - allow(helper).to receive(:merge_request_supports_multiple_reviewers?).and_return(true) - - expect(helper.reviewers_dropdown_options(merge_request)[:data][:'max-select']) - .to eq(nil) - end - end - - context "with only 1 reviewer" do - it 'correctly returns the max amount of reviewers or assignees to allow' do - expect(helper.reviewers_dropdown_options(merge_request)[:data][:'max-select']) - .to eq(1) - end + context "with only 1 reviewer" do + it 'correctly returns the max amount of reviewers or assignees to allow' do + expect(helper.reviewers_dropdown_options(merge_request)[:data][:'max-select']) + .to eq(1) end end end |