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
add expected mails to spec
ulferts6ff1d1a43004
diff --git a/lib/copy_model.rb b/lib/copy_model.rbindex d75ac4d1545..f6e25e9937b 100644--- a/lib/copy_model.rb+++ b/lib/copy_model.rb@@ -59,9 +59,9 @@ module CopyModelto_be_copied = self.class.reflect_on_all_associations.map(&:name)to_be_copied = Array(options[:only]) unless options[:only].nil?- to_be_copied = to_be_copied.map(&:to_s).sort { |a, b|+ to_be_copied = to_be_copied.map(&:to_s).sort do |a, b|(copy_precedence.map(&:to_s).index(a) || -1) <=> (copy_precedence.map(&:to_s).index(b) || -1)- }.map(&:to_sym)+ end.map(&:to_sym)with_model(from_model) do |model|self.class.transaction dodiff --git a/spec/features/projects/copy_spec.rb b/spec/features/projects/copy_spec.rbindex afc7f17a750..d179fef05f8 100644--- a/spec/features/projects/copy_spec.rb+++ b/spec/features/projects/copy_spec.rb@@ -31,13 +31,12 @@ require 'spec_helper'describe 'Projects copy',type: :feature,js: true do-describe 'with a full copy example' dolet!(:project) doproject = FactoryBot.create(:project,parent: parent_project,types: active_types,- custom_field_values: {project_custom_field.id => 'some text cf'})+ custom_field_values: { project_custom_field.id => 'some text cf' })FactoryBot.create(:member,project: project,@@ -109,7 +108,7 @@ describe 'Projects copy',category: category,fixed_version: version,description: 'Some desciption',- custom_field_values: {wp_custom_field.id => 'Some wp cf text'})+ custom_field_values: { wp_custom_field.id => 'Some wp cf text' })endlet!(:wiki) { project.wiki }@@ -123,9 +122,10 @@ describe 'Projects copy',before dologin_as user- allow(Delayed::Worker)- .to receive(:delay_jobs)- .and_return(false)+ # Clear all jobs that would later on to having emails send.+ # The jobs are created as part of the object creation.+ clear_enqueued_jobs+ clear_performed_jobsendit 'copies projects and the associated objects' do@@ -219,6 +219,15 @@ describe 'Projects copy',.to eql copied_project.versions.find_by(name: version.name)expect(copied_work_package.custom_value_attributes).to eql(wp_custom_field.id => 'Some wp cf text')++ expect(ActionMailer::Base.deliveries.count)+ .to eql(1)++ expect(ActionMailer::Base.deliveries.last.subject)+ .to eql("Created project Copied project")++ expect(ActionMailer::Base.deliveries.last.to)+ .to match_array([user.mail])endend@@ -242,26 +251,20 @@ describe 'Projects copy',let(:child2_3) { FactoryBot.create :work_package, default_params.merge(parent: parent2, subject: 'Prepare launch') }let(:child2_4) { FactoryBot.create :work_package, default_params.merge(parent: parent2, subject: 'Launch') }- let(:order) {+ let(:order) do[parent1, child1_1, child1_2, parent2, child2_1, child2_2, child2_3, child2_4]- }+ endbefore do- parent1- child1_1- child1_2+ # create work packages in expected order+ order- parent2- child2_1- child2_2- child2_3- child2_4+ # Clear all jobs that would later on to having emails send.+ # The jobs are created as part of the object creation.+ clear_enqueued_jobs+ clear_performed_jobslogin_as user-- allow(Delayed::Worker)- .to receive(:delay_jobs)- .and_return(false)endlet(:wp_table) { ::Pages::WorkPackagesTable.new project }