From 941ae9628f6c9c3d04dcec0d05ad0f74e8a94958 Mon Sep 17 00:00:00 2001 From: ulferts Date: Tue, 24 May 2022 14:17:49 +0200 Subject: [PATCH] linting hash value --- spec/factories/work_package_factory.rb | 2 +- .../work_packages/details/date_editor_spec.rb | 8 ++--- .../scheduling/scheduling_mode_spec.rb | 14 ++++---- .../wysiwyg/macros/quicklink_macros_spec.rb | 2 +- .../set_attributes_service_spec.rb | 34 +++++++++---------- 5 files changed, 29 insertions(+), 31 deletions(-) diff --git a/spec/factories/work_package_factory.rb b/spec/factories/work_package_factory.rb index ebeaca799e..e56eef1180 100644 --- a/spec/factories/work_package_factory.rb +++ b/spec/factories/work_package_factory.rb @@ -68,7 +68,7 @@ FactoryBot.define do if custom_values.is_a? Hash custom_values.each_pair do |custom_field_id, value| - work_package.custom_values.build custom_field_id: custom_field_id, value: value + work_package.custom_values.build custom_field_id:, value: end else custom_values.each { |cv| work_package.custom_values << cv } diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb index defb6b9cdf..f88dad0b8a 100644 --- a/spec/features/work_packages/details/date_editor_spec.rb +++ b/spec/features/work_packages/details/date_editor_spec.rb @@ -37,7 +37,7 @@ describe 'date inplace editor', with_settings: { date_format: '%Y-%m-%d' }, js: true, selenium: true do let(:project) { create :project_with_types, public: true } - let(:work_package) { create :work_package, project: project, start_date: Date.parse('2016-01-02') } + let(:work_package) { create :work_package, project:, start_date: Date.parse('2016-01-02') } let(:user) { create :admin } let(:work_packages_page) { Pages::FullWorkPackage.new(work_package, project) } let(:wp_table) { Pages::WorkPackagesTable.new(project) } @@ -95,7 +95,7 @@ describe 'date inplace editor', context 'with start and end date set' do let(:work_package) do create :work_package, - project: project, + project:, start_date: Date.parse('2016-01-02'), due_date: Date.parse('2016-01-25') end @@ -161,7 +161,7 @@ describe 'date inplace editor', end context 'with the start date empty' do - let(:work_package) { create :work_package, project: project, start_date: nil } + let(:work_package) { create :work_package, project:, start_date: nil } it 'can set "today" as a date via the provided link' do start_date.activate! @@ -245,7 +245,7 @@ describe 'date inplace editor', let(:cf_field) { EditField.new page, :"customField#{date_cf.id}" } let(:datepicker) { ::Components::Datepicker.new } - let(:create_page) { ::Pages::FullWorkPackageCreate.new(project: project) } + let(:create_page) { ::Pages::FullWorkPackageCreate.new(project:) } it 'can handle creating a CF date' do create_page.visit! diff --git a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb b/spec/features/work_packages/scheduling/scheduling_mode_spec.rb index 8f8afd7ae4..1264eb18d1 100644 --- a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb +++ b/spec/features/work_packages/scheduling/scheduling_mode_spec.rb @@ -52,27 +52,27 @@ describe 'scheduling mode', # let!(:wp) do create :work_package, - project: project, + project:, start_date: Date.parse('2016-01-01'), due_date: Date.parse('2016-01-05'), parent: wp_parent end let!(:wp_parent) do create(:work_package, - project: project, + project:, start_date: Date.parse('2016-01-01'), due_date: Date.parse('2016-01-05')) end let!(:wp_child) do create(:work_package, - project: project, + project:, start_date: Date.parse('2016-01-01'), due_date: Date.parse('2016-01-05'), parent: wp) end let!(:wp_pre) do create(:work_package, - project: project, + project:, start_date: Date.parse('2015-12-15'), due_date: Date.parse('2015-12-31')).tap do |pre| create(:follows_relation, from: wp, to: pre) @@ -80,7 +80,7 @@ describe 'scheduling mode', end let!(:wp_suc) do create(:work_package, - project: project, + project:, start_date: Date.parse('2016-01-06'), due_date: Date.parse('2016-01-10'), parent: wp_suc_parent).tap do |suc| @@ -89,13 +89,13 @@ describe 'scheduling mode', end let!(:wp_suc_parent) do create(:work_package, - project: project, + project:, start_date: Date.parse('2016-01-06'), due_date: Date.parse('2016-01-10')) end let!(:wp_suc_child) do create(:work_package, - project: project, + project:, start_date: Date.parse('2016-01-06'), due_date: Date.parse('2016-01-10'), parent: wp_suc) diff --git a/spec/features/wysiwyg/macros/quicklink_macros_spec.rb b/spec/features/wysiwyg/macros/quicklink_macros_spec.rb index abd6af950a..92f389408e 100644 --- a/spec/features/wysiwyg/macros/quicklink_macros_spec.rb +++ b/spec/features/wysiwyg/macros/quicklink_macros_spec.rb @@ -35,7 +35,7 @@ describe 'Wysiwyg work package quicklink macros', type: :feature, js: true do let!(:work_package) do create(:work_package, subject: "Foo Bar", - project: project, + project:, start_date: Date.parse('2020-01-01'), due_date: Date.parse('2020-02-01')) end diff --git a/spec/services/work_packages/set_attributes_service_spec.rb b/spec/services/work_packages/set_attributes_service_spec.rb index 8b5867e191..8a439de8f9 100644 --- a/spec/services/work_packages/set_attributes_service_spec.rb +++ b/spec/services/work_packages/set_attributes_service_spec.rb @@ -37,7 +37,7 @@ describe WorkPackages::SetAttributesService, type: :model do p end let(:work_package) do - wp = build_stubbed(:work_package, project: project) + wp = build_stubbed(:work_package, project:) wp.type = initial_type wp.send(:clear_changes_information) @@ -64,7 +64,7 @@ describe WorkPackages::SetAttributesService, type: :model do instance_double(ActiveModel::Errors) end let(:instance) do - described_class.new(user: user, + described_class.new(user:, model: work_package, contract_class: mock_contract) end @@ -280,9 +280,9 @@ describe WorkPackages::SetAttributesService, type: :model do end let(:user) { build_stubbed(:admin) } let(:instance) do - described_class.new(user: user, + described_class.new(user:, model: invalid_wp, - contract_class: contract_class) + contract_class:) end context 'with a current invalid start date' do @@ -312,7 +312,7 @@ describe WorkPackages::SetAttributesService, type: :model do let(:parent_due_date) { Time.zone.today + 10.days } context 'with the parent having dates and not providing own dates' do - let(:call_attributes) { { parent: parent } } + let(:call_attributes) { { parent: } } it_behaves_like 'service call' do it "sets the start_date to the parent`s start_date" do @@ -332,7 +332,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having start date (no due) and not providing own dates' do - let(:call_attributes) { { parent: parent } } + let(:call_attributes) { { parent: } } let(:parent_due_date) { nil } it_behaves_like 'service call' do @@ -353,7 +353,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having due date (no start) and not providing own dates' do - let(:call_attributes) { { parent: parent } } + let(:call_attributes) { { parent: } } let(:parent_start_date) { nil } it_behaves_like 'service call' do @@ -374,7 +374,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing own dates' do - let(:call_attributes) { { parent: parent, start_date: Time.zone.today, due_date: Time.zone.today + 1.day } } + let(:call_attributes) { { parent:, start_date: Time.zone.today, due_date: Time.zone.today + 1.day } } it_behaves_like 'service call' do it "sets the start_date to the provided date" do @@ -394,7 +394,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing own start_date' do - let(:call_attributes) { { parent: parent, start_date: Time.zone.today } } + let(:call_attributes) { { parent:, start_date: Time.zone.today } } it_behaves_like 'service call' do it "sets the start_date to the provided date" do @@ -414,7 +414,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing own due_date' do - let(:call_attributes) { { parent: parent, due_date: Time.zone.today + 4.days } } + let(:call_attributes) { { parent:, due_date: Time.zone.today + 4.days } } it_behaves_like 'service call' do it "sets the start_date to the parent's start date" do @@ -434,7 +434,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing own empty start_date' do - let(:call_attributes) { { parent: parent, start_date: nil } } + let(:call_attributes) { { parent:, start_date: nil } } it_behaves_like 'service call' do it "sets the start_date to nil" do @@ -454,7 +454,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing own empty due_date' do - let(:call_attributes) { { parent: parent, due_date: nil } } + let(:call_attributes) { { parent:, due_date: nil } } it_behaves_like 'service call' do it "sets the start_date to the parent's start date" do @@ -474,7 +474,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing a start date that is before parent`s due date`' do - let(:call_attributes) { { parent: parent, start_date: parent_due_date - 4.days } } + let(:call_attributes) { { parent:, start_date: parent_due_date - 4.days } } it_behaves_like 'service call' do it "sets the start_date to the provided date" do @@ -494,7 +494,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing a start date that is after the parent`s due date`' do - let(:call_attributes) { { parent: parent, start_date: parent_due_date + 1.day } } + let(:call_attributes) { { parent:, start_date: parent_due_date + 1.day } } it_behaves_like 'service call' do it "sets the start_date to the provided date" do @@ -514,7 +514,7 @@ describe WorkPackages::SetAttributesService, type: :model do end context 'with the parent having dates but providing a due date that is before the parent`s start date`' do - let(:call_attributes) { { parent: parent, due_date: parent_start_date - 3.days } } + let(:call_attributes) { { parent:, due_date: parent_start_date - 3.days } } it_behaves_like 'service call' do it "leaves the start date empty" do @@ -928,7 +928,6 @@ describe WorkPackages::SetAttributesService, type: :model do end end - # rubocop:disable RSpec/MultipleMemoizedHelpers context 'when switching the project' do let(:new_project) { build_stubbed(:project) } let(:version) { build_stubbed(:version) } @@ -1121,7 +1120,6 @@ describe WorkPackages::SetAttributesService, type: :model do end end end - # rubocop:enable RSpec/MultipleMemoizedHelpers context 'for custom fields' do subject { instance.call(call_attributes) } @@ -1142,7 +1140,7 @@ describe WorkPackages::SetAttributesService, type: :model do context 'when switching back to automatic scheduling' do let(:work_package) do wp = build_stubbed(:work_package, - project: project, + project:, schedule_manually: true, start_date: Time.zone.today, due_date: Time.zone.today + 5.days)