diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-23 14:08:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-23 14:08:56 +0300 |
commit | 60e912453247fce53f0ed975f675b9f48bcfb54f (patch) | |
tree | 894e0048bee8bb5c065a8c0ac0eaa640dc667d70 /spec | |
parent | 77d81d7c756bf5b9e4f25aea294973b0d3b550da (diff) |
Add latest changes from gitlab-org/gitlab@14-9-stable-ee
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/admin/application_settings_controller_spec.rb | 40 | ||||
-rw-r--r-- | spec/factories/ci/job_artifacts.rb | 2 | ||||
-rw-r--r-- | spec/models/ci/deleted_object_spec.rb | 2 |
3 files changed, 42 insertions, 2 deletions
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb index f7b2bab3615..a18ebe9c9a0 100644 --- a/spec/controllers/admin/application_settings_controller_spec.rb +++ b/spec/controllers/admin/application_settings_controller_spec.rb @@ -291,6 +291,46 @@ RSpec.describe Admin::ApplicationSettingsController, :do_not_mock_admin_mode_set end end end + + describe 'user_email_lookup_limit aliasing' do + let(:application_setting) { ApplicationSetting.current } + let(:user_email_lookup_limit) { 8675 } + let(:search_rate_limit) { 309 } + + context 'when search_rate_limit is specified' do + let(:settings_params) do + { + user_email_lookup_limit: user_email_lookup_limit, + search_rate_limit: search_rate_limit + } + end + + it 'updates search_rate_limit with correct value' do + expect(application_setting.search_rate_limit).not_to eq user_email_lookup_limit + expect(application_setting.search_rate_limit).not_to eq search_rate_limit + + put :update, params: { application_setting: settings_params } + + expect(application_setting.reload.search_rate_limit).to eq search_rate_limit + end + end + + context 'when search_rate_limit is not specified' do + let(:settings_params) do + { + user_email_lookup_limit: search_rate_limit + } + end + + it 'applies user_email_lookup_limit value to search_rate_limit' do + expect(application_setting.search_rate_limit).not_to eq search_rate_limit + + put :update, params: { application_setting: settings_params } + + expect(application_setting.reload.search_rate_limit).to eq search_rate_limit + end + end + end end describe 'PUT #reset_registration_token' do diff --git a/spec/factories/ci/job_artifacts.rb b/spec/factories/ci/job_artifacts.rb index e6eec280ed0..77b07c4a404 100644 --- a/spec/factories/ci/job_artifacts.rb +++ b/spec/factories/ci/job_artifacts.rb @@ -7,7 +7,7 @@ FactoryBot.define do file_format { :zip } trait :expired do - expire_at { Date.yesterday } + expire_at { Time.current.yesterday.change(minute: 9) } end trait :locked do diff --git a/spec/models/ci/deleted_object_spec.rb b/spec/models/ci/deleted_object_spec.rb index cb8911d5027..a19c1b76708 100644 --- a/spec/models/ci/deleted_object_spec.rb +++ b/spec/models/ci/deleted_object_spec.rb @@ -22,7 +22,7 @@ RSpec.describe Ci::DeletedObject, :aggregate_failures do expect(deleted_artifact.file_store).to eq(artifact.file_store) expect(deleted_artifact.store_dir).to eq(artifact.file.store_dir.to_s) expect(deleted_artifact.file_identifier).to eq(artifact.file_identifier) - expect(deleted_artifact.pick_up_at).to eq(artifact.expire_at) + expect(deleted_artifact.pick_up_at).to be_like_time(artifact.expire_at) end end |