From 7a9a6e8e2cfd625d54138d4e6d4a4ee884b1f807 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 11:09:30 +0000 Subject: [PATCH 1/3] build(deps-dev): bump rubocop-rspec from 2.25.0 to 2.26.0 Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.25.0 to 2.26.0. - [Release notes](https://github.com/rubocop/rubocop-rspec/releases) - [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.25.0...v2.26.0) --- updated-dependencies: - dependency-name: rubocop-rspec dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index ece4e268323..01cb5b7ffb3 100644 --- a/Gemfile +++ b/Gemfile @@ -92,7 +92,7 @@ group :test do gem 'rspec-wait' gem 'rubocop', '~> 1.59.0' gem 'rubocop-rails', '~> 2.23' - gem 'rubocop-rspec', '~> 2.25' + gem 'rubocop-rspec', '~> 2.26' gem 'rubocop-sequel', '~> 0.3.4' gem 'timecop' gem 'webmock', '> 2.3.1' diff --git a/Gemfile.lock b/Gemfile.lock index 5d6919cb1ec..9328c1705d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -462,16 +462,16 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.19.0) + rubocop-capybara (2.20.0) rubocop (~> 1.41) - rubocop-factory_bot (2.24.0) + rubocop-factory_bot (2.25.0) rubocop (~> 1.33) rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) rubocop-ast (>= 1.30.0, < 2.0) - rubocop-rspec (2.25.0) + rubocop-rspec (2.26.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) @@ -643,7 +643,7 @@ DEPENDENCIES rspec_api_documentation (>= 6.1.0) rubocop (~> 1.59.0) rubocop-rails (~> 2.23) - rubocop-rspec (~> 2.25) + rubocop-rspec (~> 2.26) rubocop-sequel (~> 0.3.4) rubyzip (>= 1.3.0) sequel (~> 5.75) From 3da927bb446162d56507d79055a1ddefbb259357 Mon Sep 17 00:00:00 2001 From: "M. Oleske" Date: Fri, 5 Jan 2024 15:28:58 -0800 Subject: [PATCH 2/3] Fix failed rubocop RSpec/ExampleWording do not use future tense --- spec/unit/actions/deployment_create_spec.rb | 2 +- .../actions/manifest_route_update_spec.rb | 2 +- .../controllers/v3/spaces_controller_spec.rb | 2 +- .../runtime/orphaned_blobs_cleanup_spec.rb | 4 +-- .../lib/cloud_controller/encryptor_spec.rb | 8 +++--- spec/unit/messages/validators_spec.rb | 8 +++--- .../runtime/buildpack_bits_delete_spec.rb | 4 +-- spec/unit/models/runtime/buildpack_spec.rb | 2 +- .../models/runtime/quota_definition_spec.rb | 2 +- .../app_usage_event_repository_spec.rb | 28 +++++++++---------- .../service_usage_event_repository_spec.rb | 14 +++++----- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/spec/unit/actions/deployment_create_spec.rb b/spec/unit/actions/deployment_create_spec.rb index dd52c31b319..f23ad3d642c 100644 --- a/spec/unit/actions/deployment_create_spec.rb +++ b/spec/unit/actions/deployment_create_spec.rb @@ -904,7 +904,7 @@ module VCAP::CloudController }) end - it 'will raise a DeploymentCreate::Error with the correct message' do + it 'raises a DeploymentCreate::Error with the correct message' do expect do expect do DeploymentCreate.create(app:, message:, user_audit_info:) diff --git a/spec/unit/actions/manifest_route_update_spec.rb b/spec/unit/actions/manifest_route_update_spec.rb index 525c4530f96..99141d66241 100644 --- a/spec/unit/actions/manifest_route_update_spec.rb +++ b/spec/unit/actions/manifest_route_update_spec.rb @@ -63,7 +63,7 @@ module VCAP::CloudController RouteMappingModel.make(app: app, route: route2) end - it 'will update (or recreate) the route mapping with the new protocol' do + it 'updates (or recreate) the route mapping with the new protocol' do ManifestRouteUpdate.update(app.guid, message, user_audit_info) route_mappings = app.reload.route_mappings diff --git a/spec/unit/controllers/v3/spaces_controller_spec.rb b/spec/unit/controllers/v3/spaces_controller_spec.rb index e4fab80f8b3..e3a432256e3 100644 --- a/spec/unit/controllers/v3/spaces_controller_spec.rb +++ b/spec/unit/controllers/v3/spaces_controller_spec.rb @@ -865,7 +865,7 @@ end context 'when the org has not been entitled with the isolation segment' do - it 'will not assign an isolation segment to a space in a different org' do + it 'does not assign an isolation segment to a space in a different org' do patch :update_isolation_segment, params: { guid: space3.guid }.merge(update_message), as: :json expect(response).to have_http_status(:unprocessable_entity) diff --git a/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb b/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb index 77bbe1e0716..d0d5f289739 100644 --- a/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb +++ b/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb @@ -261,7 +261,7 @@ module Jobs::Runtime [double(:blob, key: 're/al/')] end - it 'will never mark the blob as an orphan' do + it 'nevers mark the blob as an orphan' do expect(OrphanedBlob.count).to eq(0) job.perform expect(OrphanedBlob.count).to eq(0) @@ -276,7 +276,7 @@ module Jobs::Runtime ] end - it 'will never mark the blob as an orphan' do + it 'nevers mark the blob as an orphan' do expect(OrphanedBlob.count).to eq(0) job.perform expect(OrphanedBlob.count).to eq(0) diff --git a/spec/unit/lib/cloud_controller/encryptor_spec.rb b/spec/unit/lib/cloud_controller/encryptor_spec.rb index 753296560f6..1ebd9228802 100644 --- a/spec/unit/lib/cloud_controller/encryptor_spec.rb +++ b/spec/unit/lib/cloud_controller/encryptor_spec.rb @@ -47,19 +47,19 @@ module VCAP::CloudController end context 'when the label is found in the hash' do - it 'will encrypt using the value corresponding to the label' do + it 'encrypts using the value corresponding to the label' do allow(Encryptor).to receive(:current_encryption_key_label).and_return('death') expect(Encryptor.encrypt(input, salt)).to eql(encrypted_death_string) end end context 'when the label is not found in the hash' do - it 'will encrypt using current db_encryption_key when the label is not nil' do + it 'encrypts using current db_encryption_key when the label is not nil' do allow(Encryptor).to receive(:current_encryption_key_label).and_return('Inigo Montoya') expect(Encryptor.encrypt(input, salt)).to eql(encrypted_legacy_string) end - it 'will encrypt using current db_encryption_key when the label is nil' do + it 'encrypts using current db_encryption_key when the label is nil' do allow(Encryptor).to receive(:current_encryption_key_label).and_return(nil) expect(Encryptor.encrypt(input, salt)).to eql(encrypted_legacy_string) end @@ -76,7 +76,7 @@ module VCAP::CloudController allow(Encryptor).to receive(:current_encryption_key_label).and_return('foo') end - it 'will encrypt using db_encryption_key' do + it 'encrypts using db_encryption_key' do expect(Encryptor.encrypt(input, salt)).to eql(encrypted_legacy_string) end end diff --git a/spec/unit/messages/validators_spec.rb b/spec/unit/messages/validators_spec.rb index 0b18b4ff450..0e19f47c5fc 100644 --- a/spec/unit/messages/validators_spec.rb +++ b/spec/unit/messages/validators_spec.rb @@ -629,25 +629,25 @@ class Relationships < VCAP::CloudController::BaseMessage end context 'requires a valid timestamp' do - it "won't accept a malformed timestamp" do + it 'does not accept a malformed timestamp' do message = timestamp_class.new({ field: [Time.now.utc.iso8601.to_s, 'bogus'] }) expect(message).not_to be_valid expect(message.errors[:field]).to include("has an invalid timestamp format. Timestamps should be formatted as 'YYYY-MM-DDThh:mm:ssZ'") end - it "won't accept garbage" do + it 'does not accept garbage' do message = timestamp_class.new({ field: { gt: 123 } }) expect(message).not_to be_valid expect(message.errors[:field]).to include("has an invalid timestamp format. Timestamps should be formatted as 'YYYY-MM-DDThh:mm:ssZ'") end - it "won't accept fractional seconds even though it's ISO 8601-compliant" do + it "does not accept fractional seconds even though it's ISO 8601-compliant" do message = timestamp_class.new({ field: { gt: '2020-06-30T12:34:56.78Z' } }) expect(message).not_to be_valid expect(message.errors[:field]).to include("has an invalid timestamp format. Timestamps should be formatted as 'YYYY-MM-DDThh:mm:ssZ'") end - it "won't accept local time zones even though it's ISO 8601-compliant" do + it "does not accept local time zones even though it's ISO 8601-compliant" do message = timestamp_class.new({ field: { gt: '2020-06-30T12:34:56.78-0700' } }) expect(message).not_to be_valid expect(message.errors[:field]).to include("has an invalid timestamp format. Timestamps should be formatted as 'YYYY-MM-DDThh:mm:ssZ'") diff --git a/spec/unit/models/runtime/buildpack_bits_delete_spec.rb b/spec/unit/models/runtime/buildpack_bits_delete_spec.rb index ad22ffc86f6..17d7ae468d7 100644 --- a/spec/unit/models/runtime/buildpack_bits_delete_spec.rb +++ b/spec/unit/models/runtime/buildpack_bits_delete_spec.rb @@ -34,7 +34,7 @@ module VCAP::CloudController end context 'when the blob exists' do - it 'will create a job with attributes' do + it 'creates a job with attributes' do attrs = blobstore.blob(key).attributes job_attrs = { last_modified: attrs[:last_modified], @@ -48,7 +48,7 @@ module VCAP::CloudController end context 'when the blob does not exist' do - it 'will not create a job' do + it 'does not create a job' do blobstore.delete(key) expect(Jobs::Runtime::BlobstoreDelete).not_to receive(:new) diff --git a/spec/unit/models/runtime/buildpack_spec.rb b/spec/unit/models/runtime/buildpack_spec.rb index 9c6000ca239..794c7b3a9ab 100644 --- a/spec/unit/models/runtime/buildpack_spec.rb +++ b/spec/unit/models/runtime/buildpack_spec.rb @@ -50,7 +50,7 @@ def ordered_buildpacks context 'when there is a buildpack with nil stack' do let!(:buildpack) { Buildpack.create(name: 'oscar', stack: nil) } - it 'will allow updating a different field' do + it 'allows updating a different field' do expect do buildpack.update(filename: '/some/file') end.not_to raise_error diff --git a/spec/unit/models/runtime/quota_definition_spec.rb b/spec/unit/models/runtime/quota_definition_spec.rb index fdad5649166..21d67e7f60c 100644 --- a/spec/unit/models/runtime/quota_definition_spec.rb +++ b/spec/unit/models/runtime/quota_definition_spec.rb @@ -185,7 +185,7 @@ module VCAP::CloudController quota_definition.trial_db_allowed = true end - it 'will not change the value returned (deprecated)' do + it 'does not change the value returned (deprecated)' do expect do quota_definition.trial_db_allowed = true end.not_to(change do diff --git a/spec/unit/repositories/app_usage_event_repository_spec.rb b/spec/unit/repositories/app_usage_event_repository_spec.rb index 8e47693b6e3..7278c7c07e3 100644 --- a/spec/unit/repositories/app_usage_event_repository_spec.rb +++ b/spec/unit/repositories/app_usage_event_repository_spec.rb @@ -26,7 +26,7 @@ module Repositories let(:parent_app) { AppModel.make(name: 'parent-app') } let(:process) { ProcessModelFactory.make(app: parent_app, type: 'other') } - it 'will create an event which matches the app' do + it 'creates an event which matches the app' do event = repository.create_from_process(process) expect(event).to match_app(process) expect(event.parent_app_name).to eq('parent-app') @@ -34,7 +34,7 @@ module Repositories expect(event.process_type).to eq('other') end - it 'will create an event with default previous attributes' do + it 'creates an event with default previous attributes' do event = repository.create_from_process(process) default_instances = ProcessModel.db_schema[:instances][:default].to_i @@ -48,7 +48,7 @@ module Repositories context 'when a custom state is provided' do let(:custom_state) { 'CUSTOM' } - it 'will populate the event with the custom state' do + it 'populates the event with the custom state' do event = repository.create_from_process(process, custom_state) expect(event.state).to eq(custom_state) @@ -64,14 +64,14 @@ module Repositories process.reload end - it 'will create an event with pending package state' do + it 'creates an event with pending package state' do event = repository.create_from_process(process) expect(event).to match_app(process) end end context 'when the package is staged' do - it 'will create an event with staged package state' do + it 'creates an event with staged package state' do event = repository.create_from_process(process) expect(event).to match_app(process) end @@ -83,7 +83,7 @@ module Repositories process.reload end - it 'will create an event with failed package state' do + it 'creates an event with failed package state' do event = repository.create_from_process(process) expect(event).to match_app(process) end @@ -98,7 +98,7 @@ module Repositories ) end - it 'will create an event that contains the detected buildpack guid and name' do + it 'creates an event that contains the detected buildpack guid and name' do event = repository.create_from_process(process) expect(event).to match_app(process) expect(event.buildpack_guid).to eq('buildpack-guid') @@ -113,7 +113,7 @@ module Repositories process.app.lifecycle_data.update(buildpacks: [buildpack_url]) end - it 'will create an event with the buildpack url as the name' do + it 'creates an event with the buildpack url as the name' do event = repository.create_from_process(process) expect(event.buildpack_name).to eq('https://git.example.com/repo.git') end @@ -127,7 +127,7 @@ module Repositories end end - it 'will create an event without a buildpack guid' do + it 'creates an event without a buildpack guid' do event = repository.create_from_process(process) expect(event.buildpack_guid).to be_nil end @@ -138,7 +138,7 @@ module Repositories process.app.lifecycle_data.update(buildpacks: nil) end - it 'will create an event that does not contain buildpack name or guid' do + it 'creates an event that does not contain buildpack name or guid' do event = repository.create_from_process(process) expect(event.buildpack_guid).to be_nil expect(event.buildpack_name).to be_nil @@ -150,7 +150,7 @@ module Repositories process.state = nil end - it 'will raise an error' do + it 'raises an error' do expect do repository.create_from_process(process) end.to raise_error(Sequel::NotNullConstraintViolation) @@ -518,7 +518,7 @@ module Repositories allow(ProcessObserver).to receive(:updated) end - it 'will purge all existing events' do + it 'purges all existing events' do 3.times { repository.create_from_process(process) } expect do @@ -691,7 +691,7 @@ module Repositories end end - it 'will delete events created before the specified cutoff time' do + it 'deletes events created before the specified cutoff time' do process = ProcessModel.make repository.create_from_process(process) @@ -702,7 +702,7 @@ module Repositories expect(AppUsageEvent.last).to match_app(process) end - it 'will keep the last record even if before the cutoff age' do + it 'keeps the last record even if before the cutoff age' do expect do repository.delete_events_older_than(cutoff_age_in_days) end.to change(AppUsageEvent, :count).to(1) diff --git a/spec/unit/repositories/service_usage_event_repository_spec.rb b/spec/unit/repositories/service_usage_event_repository_spec.rb index d3f30bf8999..6dd8398e038 100644 --- a/spec/unit/repositories/service_usage_event_repository_spec.rb +++ b/spec/unit/repositories/service_usage_event_repository_spec.rb @@ -32,7 +32,7 @@ module Repositories context 'with managed service instance' do let(:service_instance) { ManagedServiceInstance.make } - it 'will create an event which matches the service instance and custom state' do + it 'creates an event which matches the service instance and custom state' do event = repository.create_from_service_instance(service_instance, custom_state) expect(event.state).to eq(custom_state) @@ -40,7 +40,7 @@ module Repositories end context 'fails to create the event if no custom state provided' do - it 'will raise an error' do + it 'raises an error' do expect do repository.create_from_service_instance(service_instance, nil) end.to raise_error(Sequel::NotNullConstraintViolation) @@ -53,7 +53,7 @@ module Repositories service_instance.space = nil end - it 'will raise an error' do + it 'raises an error' do expect do repository.create_from_service_instance(service_instance, custom_state) end.to raise_error(NoMethodError) @@ -65,7 +65,7 @@ module Repositories context 'with user provided service instance' do let(:service_instance) { UserProvidedServiceInstance.make } - it 'will create an event if service instance does not have a service plan' do + it 'creates an event if service instance does not have a service plan' do event = repository.create_from_service_instance(service_instance, custom_state) expect(event.state).to eq(custom_state) @@ -93,7 +93,7 @@ module Repositories end end - it 'will purge all existing events' do + it 'purges all existing events' do ServiceInstance.each(&:destroy) expect do @@ -170,7 +170,7 @@ module Repositories end end - it 'will delete events created before the specified cutoff time' do + it 'deletes events created before the specified cutoff time' do new_event = repository.create_from_service_instance(service_instance, 'SOME-STATE') expect do @@ -180,7 +180,7 @@ module Repositories expect(ServiceUsageEvent.last).to eq(new_event.reload) end - it 'will keep the last record even if before the cutoff age' do + it 'keeps the last record even if before the cutoff age' do expect do repository.delete_events_older_than(cutoff_age_in_days) end.to change(ServiceUsageEvent, :count).to(1) From a3a2f29157045a38684d5a7f87dce46b3d0cf9d8 Mon Sep 17 00:00:00 2001 From: Philipp Thun Date: Mon, 8 Jan 2024 16:20:44 +0100 Subject: [PATCH 3/3] Some minor corrections --- spec/unit/actions/manifest_route_update_spec.rb | 2 +- spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/unit/actions/manifest_route_update_spec.rb b/spec/unit/actions/manifest_route_update_spec.rb index 99141d66241..51f0f4a693c 100644 --- a/spec/unit/actions/manifest_route_update_spec.rb +++ b/spec/unit/actions/manifest_route_update_spec.rb @@ -63,7 +63,7 @@ module VCAP::CloudController RouteMappingModel.make(app: app, route: route2) end - it 'updates (or recreate) the route mapping with the new protocol' do + it 'updates (or recreates) the route mapping with the new protocol' do ManifestRouteUpdate.update(app.guid, message, user_audit_info) route_mappings = app.reload.route_mappings diff --git a/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb b/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb index d0d5f289739..cbb3d4d92f5 100644 --- a/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb +++ b/spec/unit/jobs/runtime/orphaned_blobs_cleanup_spec.rb @@ -261,7 +261,7 @@ module Jobs::Runtime [double(:blob, key: 're/al/')] end - it 'nevers mark the blob as an orphan' do + it 'never marks the blob as an orphan' do expect(OrphanedBlob.count).to eq(0) job.perform expect(OrphanedBlob.count).to eq(0) @@ -276,7 +276,7 @@ module Jobs::Runtime ] end - it 'nevers mark the blob as an orphan' do + it 'never marks the blob as an orphan' do expect(OrphanedBlob.count).to eq(0) job.perform expect(OrphanedBlob.count).to eq(0)