Skip to content

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

[41824] Ensure project export also includes description

Oliver Günthera3897c94cc0f
diff --git a/app/models/projects/exports/query_exporter.rb b/app/models/projects/exports/query_exporter.rb
index 56efc176764..a2f91cada97 100644
--- a/app/models/projects/exports/query_exporter.rb
+++ b/app/models/projects/exports/query_exporter.rb
@@ -55,7 +55,8 @@ module Projects::Exports
[
{ name: :id, caption: Project.human_attribute_name(:id) },
{ name: :identifier, caption: Project.human_attribute_name(:identifier) },
- { name: :name, caption: Project.human_attribute_name(:name) }
+ { name: :name, caption: Project.human_attribute_name(:name) },
+ { name: :description, caption: Project.human_attribute_name(:description) }
]
end
diff --git a/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb b/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb
index 7a3b12e6b96..98faee44306 100644
--- a/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb
+++ b/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb
@@ -27,7 +27,8 @@ describe XlsExport::Project::Exporter::XLS do
it 'performs a successful export' do
expect(rows.count).to eq(1)
- expect(sheet.row(1)).to eq [project.id.to_s, project.identifier, project.name, 'Off track', 'false']
+ expect(sheet.row(1)).to eq [project.id.to_s, project.identifier,
+ project.name, project.description, 'Off track', 'false']
end
describe 'custom field columns selected' do
@@ -40,7 +41,7 @@ describe XlsExport::Project::Exporter::XLS do
expect(rows.count).to eq 1
cf_names = custom_fields.map(&:name)
- expect(header).to eq ['ID', 'Identifier', 'Name', 'Status', 'Public', *cf_names]
+ expect(header).to eq ['ID', 'Identifier', 'Name', 'Description', 'Status', 'Public', *cf_names]
custom_values = custom_fields.map do |cf|
case cf
@@ -54,13 +55,13 @@ describe XlsExport::Project::Exporter::XLS do
end
expect(sheet.row(1))
- .to eq [project.id.to_s, project.identifier, project.name, 'Off track', 'false', *custom_values]
+ .to eq [project.id.to_s, project.identifier, project.name, project.description, 'Off track', 'false', *custom_values]
end
end
context 'when ee not enabled' do
it 'renders only the default columns' do
- expect(header).to eq %w[ID Identifier Name Status Public]
+ expect(header).to eq %w[ID Identifier Name Description Status Public]
end
end
end
diff --git a/spec/models/projects/exporter/csv_integration_spec.rb b/spec/models/projects/exporter/csv_integration_spec.rb
index e2dd8f3189a..4773662121f 100644
--- a/spec/models/projects/exporter/csv_integration_spec.rb
+++ b/spec/models/projects/exporter/csv_integration_spec.rb
@@ -43,7 +43,8 @@ describe Projects::Exports::CSV, 'integration', type: :model do
it 'performs a successful export' do
expect(parsed.size).to eq(2)
- expect(parsed.last).to eq [project.id.to_s, project.identifier, project.name, 'Off track', 'false']
+ expect(parsed.last).to eq [project.id.to_s, project.identifier,
+ project.name, project.description, 'Off track', 'false']
end
describe 'custom field columns selected' do
@@ -56,7 +57,7 @@ describe Projects::Exports::CSV, 'integration', type: :model do
expect(parsed.size).to eq 2
cf_names = custom_fields.map(&:name)
- expect(header).to eq ['id', 'Identifier', 'Name', 'Status', 'Public', *cf_names]
+ expect(header).to eq ['id', 'Identifier', 'Name', 'Description', 'Status', 'Public', *cf_names]
custom_values = custom_fields.map do |cf|
case cf
@@ -69,13 +70,13 @@ describe Projects::Exports::CSV, 'integration', type: :model do
end
end
expect(rows.first)
- .to eq [project.id.to_s, project.identifier, project.name, 'Off track', 'false', *custom_values]
+ .to eq [project.id.to_s, project.identifier, project.name, project.description, 'Off track', 'false', *custom_values]
end
end
context 'when ee not enabled' do
it 'renders only the default columns' do
- expect(header).to eq %w[id Identifier Name Status Public]
+ expect(header).to eq %w[id Identifier Name Description Status Public]
end
end
end
diff --git a/spec/models/projects/exporter/exportable_project_context.rb b/spec/models/projects/exporter/exportable_project_context.rb
index 5f120bfaaef..40d994174da 100644
--- a/spec/models/projects/exporter/exportable_project_context.rb
+++ b/spec/models/projects/exporter/exportable_project_context.rb
@@ -50,6 +50,7 @@ shared_context 'with a project with an arrangement of custom fields' do
shared_let(:project) do
create(:project, members: { other_user => role }).tap do |p|
+ p.description = "The description of the project"
p.send(:"custom_field_#{int_cf.id}=", 5)
p.send(:"custom_field_#{bool_cf.id}=", true)
p.send(:"custom_field_#{version_cf.id}=", system_version)