only keyword parameters on service calls

pull/9892/head
ulferts 3 years ago
parent 632e2c9f41
commit e63eebeca0
No known key found for this signature in database
GPG Key ID: A205708DE1284017
  1. 4
      app/services/base_services/base_callable.rb
  2. 2
      app/services/base_services/base_contracted.rb
  3. 2
      modules/bim/spec/workers/work_packages/exports/export_job_spec.rb
  4. 2
      modules/boards/spec/features/action_boards/status_board_spec.rb
  5. 4
      modules/boards/spec/features/action_boards/version_board_spec.rb
  6. 2
      modules/budgets/app/models/budget.rb
  7. 4
      modules/budgets/spec/models/budget_spec.rb
  8. 2
      spec/workers/copy_project_job_spec.rb
  9. 2
      spec/workers/work_packages/exports/export_job_integration_spec.rb
  10. 4
      spec/workers/work_packages/exports/export_job_spec.rb

@ -36,10 +36,10 @@ module BaseServices
include ::WithReversibleState
def call(*params)
self.params = params.first
self.params = params.first.to_h.deep_symbolize_keys
run_callbacks(:call) do
perform(*params)
perform(**(params.first || {}).to_h.deep_symbolize_keys)
end
end

@ -56,7 +56,7 @@ module BaseServices
in_context(model, true, &block)
end
def perform(params = nil)
def perform(params = {})
service_context do
service_call = validate_params(params)
service_call = before_perform(params, service_call) if service_call.success?

@ -38,7 +38,7 @@ describe WorkPackages::ExportJob do
end
let(:query) { FactoryBot.build_stubbed(:query) }
let(:job) { described_class.new(jobs_args) }
let(:job) { described_class.new(**jobs_args) }
let(:jobs_args) do
{
export: export,

@ -197,7 +197,7 @@ describe 'Status action board', type: :feature, js: true do
# Expect filter to be saved in board
board_page.board(reload: true) do |board|
expect(board.options['filters']).to eq [{ 'search' => { 'operator' => '**', 'values' => ['Task'] } }]
expect(board.options[:filters]).to eq [{ search: { operator: '**', values: ['Task'] } }]
end
# Revisit board

@ -30,6 +30,7 @@ require 'spec_helper'
require_relative './../support//board_index_page'
require_relative './../support/board_page'
# rubocop:disable RSpec:MultipleMemoizedHelpers
describe 'Version action board', type: :feature, js: true do
let(:user) do
FactoryBot.create(:user,
@ -181,7 +182,7 @@ describe 'Version action board', type: :feature, js: true do
# Expect filter to be saved in board
board_page.board(reload: true) do |board|
expect(board.options['filters']).to eq [{ 'search' => { 'operator' => '**', 'values' => ['Task'] } }]
expect(board.options[:filters]).to eq [{ search: { operator: '**', values: ['Task'] } }]
end
# Revisit board
@ -347,3 +348,4 @@ describe 'Version action board', type: :feature, js: true do
end
end
end
# rubocop:enable RSpec:MultipleMemoizedHelpers

@ -236,7 +236,7 @@ class Budget < ApplicationRecord
budget_items = send("#{type}_budget_items")
budget_items.reject(&:new_record?).each do |budget_item|
attributes = budget_item_attributes[budget_item.id.to_s]
attributes = budget_item_attributes[budget_item.id.to_s.to_sym]
send("correct_#{type}_attributes!", attributes)
if send("valid_#{type}_budget_attributes?", attributes)

@ -67,7 +67,7 @@ describe Budget, type: :model do
context 'with a non integer value' do
it 'updates the item' do
budget.existing_material_budget_item_attributes = { existing_material_budget_item.id.to_s => { units: "0.5" } }
budget.existing_material_budget_item_attributes = { existing_material_budget_item.id.to_s.to_sym => { units: "0.5" } }
expect(existing_material_budget_item.units)
.to eql 0.5
@ -76,7 +76,7 @@ describe Budget, type: :model do
context 'with no value' do
it 'deletes the item' do
budget.existing_material_budget_item_attributes = { existing_material_budget_item.id.to_s => {} }
budget.existing_material_budget_item_attributes = { existing_material_budget_item.id.to_s.to_sym => {} }
expect(existing_material_budget_item)
.to be_destroyed

@ -84,7 +84,7 @@ describe CopyProjectJob, type: :model do
}
end
let(:copy_job) do
CopyProjectJob.new(job_args).tap(&:perform_now)
described_class.new(**job_args).tap(&:perform_now)
end
let(:params) { { name: 'Copy', identifier: 'copy', type_ids: [type.id], work_package_custom_field_ids: [custom_field.id] } }

@ -43,7 +43,7 @@ describe WorkPackages::ExportJob, 'Integration' do
let(:query) { FactoryBot.create(:query, name: 'Query report 04/2021 äöü', project: project) }
let(:query_attributes) { {} }
let(:job) { described_class.new(jobs_args) }
let(:job) { described_class.new(**jobs_args) }
let(:jobs_args) do
{
export: export,

@ -39,7 +39,7 @@ describe WorkPackages::ExportJob do
let(:query) { FactoryBot.build_stubbed(:query) }
let(:query_attributes) { {} }
let(:job) { described_class.new(jobs_args) }
let(:job) { described_class.new(**jobs_args) }
let(:jobs_args) do
{
export: export,
@ -100,7 +100,7 @@ describe WorkPackages::ExportJob do
end
describe 'query passing' do
context 'passing in group_by through attributes' do
context 'when passing in group_by through attributes' do
let(:query_attributes) { { group_by: 'assigned_to' } }
let(:mime_type) { :pdf }
let(:exporter) { WorkPackage::PDFExport::WorkPackageListToPdf }

Loading…
Cancel
Save