OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#49760] fixed test setups
Eric Schubert45bdb3fc093c
diff --git a/modules/storages/app/controllers/storages/admin/storages_controller.rb b/modules/storages/app/controllers/storages/admin/storages_controller.rbindex 93b0b3d6dfb..c5ce2698642 100644--- a/modules/storages/app/controllers/storages/admin/storages_controller.rb+++ b/modules/storages/app/controllers/storages/admin/storages_controller.rb@@ -65,26 +65,16 @@ class Storages::Admin::StoragesController < ApplicationController# See also: storages/services/storages/storages/set_attributes_services.rb# That service inherits from ::BaseServices::SetAttributes@storage = ::Storages::Storages::SetAttributesService- .new(user: current_user,- model: Storages::NextcloudStorage.new,- contract_class: EmptyContract)- .call- .result+ .new(user: current_user,+ model: Storages::NextcloudStorage.new,+ contract_class: EmptyContract)+ .call+ .resultend# rubocop:disable Metrics/AbcSizedef create- storage_params = permitted_storage_params- contract_class = case storage_params['provider_type']- when ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD- ::Storages::Storages::NextcloudCreateContract- when ::Storages::Storage::PROVIDER_TYPE_ONE_DRIVE- ::Storages::Storages::OneDriveCreateContract- else- raise "Unknown provider type: #{storage_params['provider_type']}"- end-- service_result = Storages::Storages::CreateService.new(user: current_user, contract_class:).call(storage_params)+ service_result = Storages::Storages::CreateService.new(user: current_user).call(permitted_storage_params)@storage = service_result.result@oauth_application = oauth_application(service_result)@@ -121,17 +111,8 @@ class Storages::Admin::StoragesController < ApplicationController# See also: create above# Called by: Global app/config/routes.rb to serve Web pagedef update- contract_class = case @storage.provider_type- when ::Storages::Storage::PROVIDER_TYPE_NEXTCLOUD- ::Storages::Storages::NextcloudUpdateContract- when ::Storages::Storage::PROVIDER_TYPE_ONE_DRIVE- ::Storages::Storages::OneDriveUpdateContract- end-service_result = ::Storages::Storages::UpdateService- .new(user: current_user,- model: @storage,- contract_class:)+ .new(user: current_user, model: @storage).call(permitted_storage_params)if service_result.success?diff --git a/modules/storages/spec/services/storages/file_links/set_attributes_service_spec.rb b/modules/storages/spec/services/storages/file_links/set_attributes_service_spec.rbindex 76fc55e3251..3497d48bfdd 100644--- a/modules/storages/spec/services/storages/file_links/set_attributes_service_spec.rb+++ b/modules/storages/spec/services/storages/file_links/set_attributes_service_spec.rb@@ -53,11 +53,11 @@ RSpec.describe Storages::FileLinks::SetAttributesService, type: :model doendlet(:model_instance) { Storages::Storage.new }let(:contract_class) do- allow(Storages::Storages::NextcloudCreateContract)+ allow(Storages::Storages::CreateContract).to receive(:new).and_return(contract_instance)- Storages::Storages::NextcloudCreateContract+ Storages::Storages::CreateContractendlet(:params) { {} }diff --git a/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rb b/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rbindex 0633712c184..e03f96b184e 100644--- a/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rb+++ b/modules/storages/spec/services/storages/storages/set_attributes_service_spec.rb@@ -35,7 +35,7 @@ RSpec.describe Storages::Storages::SetAttributesService, type: :model dolet(:current_user) { build_stubbed(:admin) }let(:contract_instance) do- contract = instance_double(Storages::Storages::NextcloudCreateContract, 'contract_instance')+ contract = instance_double(Storages::Storages::CreateContract, 'contract_instance')allow(contract).to receive_messages(validate: contract_valid, errors: contract_errors)contractend@@ -52,11 +52,11 @@ RSpec.describe Storages::Storages::SetAttributesService, type: :model doendlet(:model_instance) { Storages::Storage.new }let(:contract_class) do- allow(Storages::Storages::NextcloudCreateContract)+ allow(Storages::Storages::CreateContract).to receive(:new).and_return(contract_instance)- Storages::Storages::NextcloudCreateContract+ Storages::Storages::CreateContractendlet(:params) { { provider_type: Storages::Storage::PROVIDER_TYPE_NEXTCLOUD } }diff --git a/modules/storages/spec/services/storages/storages/update_service_spec.rb b/modules/storages/spec/services/storages/storages/update_service_spec.rbindex 16180b5487d..0d3145f0145 100644--- a/modules/storages/spec/services/storages/storages/update_service_spec.rb+++ b/modules/storages/spec/services/storages/storages/update_service_spec.rb@@ -72,8 +72,7 @@ RSpec.describe Storages::Storages::UpdateService, type: :model dostorage_creator = create(:admin, login: "storage_creator")storage = create(:nextcloud_storage, creator: storage_creator)service = described_class.new(user: create(:admin),- model: storage,- contract_class: Storages::Storages::NextcloudUpdateContract)+ model: storage)service_result = service.call(creator: create(:user, login: "impostor"))@@ -90,7 +89,7 @@ RSpec.describe Storages::Storages::UpdateService, type: :model dosubject dodescribed_class- .new(user:, model: storage, contract_class: Storages::Storages::NextcloudUpdateContract)+ .new(user:, model: storage).call({ name: })end