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
tests[Op#54749]: add unit test for project descendants
Kabiru Mwenja4dae5df1478d
diff --git a/spec/services/project_custom_field_project_mappings/bulk_create_service_spec.rb b/spec/services/project_custom_field_project_mappings/bulk_create_service_spec.rbindex 968458780c1..464f6c3663b 100644--- a/spec/services/project_custom_field_project_mappings/bulk_create_service_spec.rb+++ b/spec/services/project_custom_field_project_mappings/bulk_create_service_spec.rb@@ -51,14 +51,17 @@ RSpec.describe ProjectCustomFieldProjectMappings::BulkCreateService docontext "with subprojects" dolet(:project) { create(:project) }let!(:subproject) { create(:project, parent: project) }- let(:instance) { described_class.new(user:, project:, project_custom_field:, include_sub_projects: true) }+ let!(:subproject2) { create(:project, parent: subproject) }it "creates the mappings for the project and sub-projects" do- expect { instance.call }.to change(ProjectCustomFieldProjectMapping, :count).by(2)+ create_service = described_class.new(user:, project: project.reload, project_custom_field:,+ include_sub_projects: true)++ expect { create_service.call }.to change(ProjectCustomFieldProjectMapping, :count).by(3)aggregate_failures "creates the mapping for the correct project and custom field" do- expect(ProjectCustomFieldProjectMapping.last.project).to eq(subproject)- expect(ProjectCustomFieldProjectMapping.last.project_custom_field).to eq(project_custom_field)+ expect(ProjectCustomFieldProjectMapping.where(project_custom_field:).pluck(:project_id))+ .to contain_exactly(project.id, subproject.id, subproject2.id)endendend