From 9f07793e08089c44f94af910e7dd95501552a801 Mon Sep 17 00:00:00 2001 From: Aaron Collier Date: Mon, 14 Aug 2023 14:52:29 -0700 Subject: [PATCH] Enable new cops and fix linting errors --- .rubocop.yml | 16 ++++++++++++++++ .../replication/druid_version_zip_part_spec.rb | 3 +-- .../shared_examples_replication_to_endpoint.rb | 3 +-- .../dashboard/replication_service_spec.rb | 3 +-- .../moab_record_service/update_version_spec.rb | 3 +-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 8832cec3d..c4f7d9c6f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -581,3 +581,19 @@ RSpec/IndexedLet: # new in 2.20 RSpec/MatchArray: # new in 2.19 Enabled: true +Lint/MixedCaseRange: # new in 1.53 + Enabled: true +Lint/RedundantRegexpQuantifiers: # new in 1.53 + Enabled: true +Style/RedundantCurrentDirectoryInPath: # new in 1.53 + Enabled: true +Style/RedundantRegexpArgument: # new in 1.53 + Enabled: true +Style/ReturnNilInPredicateMethodDefinition: # new in 1.53 + Enabled: true +Style/YAMLFileRead: # new in 1.53 + Enabled: true +RSpec/ReceiveMessages: # new in 2.23 + Enabled: true +RSpec/Rails/NegationBeValid: # new in 2.23 + Enabled: true diff --git a/spec/models/replication/druid_version_zip_part_spec.rb b/spec/models/replication/druid_version_zip_part_spec.rb index 32a0ed05a..0b07bbed4 100644 --- a/spec/models/replication/druid_version_zip_part_spec.rb +++ b/spec/models/replication/druid_version_zip_part_spec.rb @@ -32,8 +32,7 @@ let(:md5) { 'fakemd5' } before do - allow(part).to receive(:md5).and_return(md5) - allow(part).to receive(:md5_path).and_return(md5_path) + allow(part).to receive_messages(md5: md5, md5_path: md5_path) end it 'writes the md5 to the md5_path' do diff --git a/spec/services/audit/shared_examples_replication_to_endpoint.rb b/spec/services/audit/shared_examples_replication_to_endpoint.rb index d1c08f562..948fdb862 100644 --- a/spec/services/audit/shared_examples_replication_to_endpoint.rb +++ b/spec/services/audit/shared_examples_replication_to_endpoint.rb @@ -18,8 +18,7 @@ before do allow(Audit::Results).to receive(:new).and_return(results) allow(provider_class).to receive(:new).and_return(provider) - allow(provider).to receive(:bucket).and_return(bucket) - allow(provider).to receive(:bucket_name).and_return(bucket_name) + allow(provider).to receive_messages(bucket: bucket, bucket_name: bucket_name) end context 'some parts are unreplicated' do diff --git a/spec/services/dashboard/replication_service_spec.rb b/spec/services/dashboard/replication_service_spec.rb index 86ad66c3e..8ddb335f9 100644 --- a/spec/services/dashboard/replication_service_spec.rb +++ b/spec/services/dashboard/replication_service_spec.rb @@ -34,8 +34,7 @@ context 'when replication_ok? and zip_parts_ok? are both true' do before do - allow(test_class).to receive(:replication_ok?).and_return(true) - allow(test_class).to receive(:zip_parts_ok?).and_return(true) + allow(test_class).to receive_messages(replication_ok?: true, zip_parts_ok?: true) end it 'returns true' do diff --git a/spec/services/moab_record_service/update_version_spec.rb b/spec/services/moab_record_service/update_version_spec.rb index 48ca4cfec..04eaf78fa 100644 --- a/spec/services/moab_record_service/update_version_spec.rb +++ b/spec/services/moab_record_service/update_version_spec.rb @@ -182,8 +182,7 @@ context 'ActiveRecordError' do let(:results) do allow(Rails.logger).to receive(:log) - allow(moab_record_service).to receive(:preserved_object).and_return(preserved_object) - allow(moab_record_service).to receive(:moab_record).and_return(moab_record) + allow(moab_record_service).to receive_messages(preserved_object: preserved_object, moab_record: moab_record) allow(moab_record).to receive(:save!).and_raise(ActiveRecord::ActiveRecordError, 'foo') moab_record_service.execute.results end