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
Replace author reference of MeetingAgendaItem
Oliver Güntheraa9dbc061c9b
diff --git a/app/services/principals/replace_references_service.rb b/app/services/principals/replace_references_service.rbindex 5c203b785a0..a39f86e23a1 100644--- a/app/services/principals/replace_references_service.rb+++ b/app/services/principals/replace_references_service.rb@@ -85,7 +85,9 @@ module PrincipalsMessage,Budget,MeetingAgenda,- MeetingMinutes].each do |klass|+ MeetingMinutes,+ MeetingAgendaItem+ ].each do |klass|rewrite(klass, :author_id, from, to)endenddiff --git a/modules/meeting/spec/factories/meeting_agenda_item_factory.rb b/modules/meeting/spec/factories/meeting_agenda_item_factory.rbindex 34686b173ad..6e30049ab64 100644--- a/modules/meeting/spec/factories/meeting_agenda_item_factory.rb+++ b/modules/meeting/spec/factories/meeting_agenda_item_factory.rb@@ -28,7 +28,7 @@FactoryBot.define dofactory :meeting_agenda_item do |m|- meeting+ meeting factory: :structured_meetingwork_package { nil }author factory: :userduration_in_minutes { 10 }diff --git a/modules/meeting/spec/services/principals/replace_references_service_call_integration_spec.rb b/modules/meeting/spec/services/principals/replace_references_service_call_integration_spec.rbnew file mode 100644index 00000000000..b65b98eaa69--- /dev/null+++ b/modules/meeting/spec/services/principals/replace_references_service_call_integration_spec.rb@@ -0,0 +1,67 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2023 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require 'spec_helper'+require_module_spec_helper++RSpec.describe Principals::ReplaceReferencesService, '#call', type: :model do+ shared_let(:principal) { create(:user) }+ shared_let(:to_principal) { create(:user) }++ subject(:service_call) { instance.call(from: principal, to: to_principal) }++ let(:instance) do+ described_class.new+ end++ shared_examples 'replaces the creator' do+ before do+ model+ end++ it 'is successful' do+ expect(service_call)+ .to be_success+ end++ it 'replaces principal with to_principal' do+ service_call+ model.reload++ expect(model.author).to eql to_principal+ end+ end++ context 'with MeetingAgendaItem' do+ it_behaves_like 'replaces the creator' do+ let(:model) { create(:meeting_agenda_item, author: principal) }+ end+ end+end