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
adjust tests for export time with zone in the filename
as-op2bff8a0e866f
diff --git a/spec/workers/work_packages/exports/export_job_integration_spec.rb b/spec/workers/work_packages/exports/export_job_integration_spec.rbindex 6a7acedd0d3..afd35dca302 100644--- a/spec/workers/work_packages/exports/export_job_integration_spec.rb+++ b/spec/workers/work_packages/exports/export_job_integration_spec.rb@@ -55,6 +55,8 @@ RSpec.describe WorkPackages::ExportJob, "Integration" doendlet(:options) { {} }let(:mime_type) { :pdf }+ let(:test_time) { Time.zone.now }+ let(:test_time_s) { test_time.strftime("%Y-%m-%d_%H-%M") }let(:performed_job) dojob.tap(&:perform_now)@@ -64,19 +66,20 @@ RSpec.describe WorkPackages::ExportJob, "Integration" doJobStatus::Status.find_by(job_id: job.job_id)end+ before do+ allow(Time.zone).to receive(:now).and_return(test_time)+ end+describe "with special characters in the project title" dolet(:project) { create(:project, name: "Foo Bla. Report No. 4/2021 with/for Case 42") }it "exports the job correctly, renaming the result" do- time = DateTime.new(2023, 6, 30, 23, 59)- allow(DateTime).to receive(:now).and_return(time)-expect { performed_job }.not_to raise_errorexpect(job_status.status).to eq "success"attachment = export.attachments.last- expected = "Foo_Bla_Report_No._4_2021_with_for_Case_42_Query_report_04_2021__2023-06-30_23-59.pdf"+ expected = "Foo_Bla_Report_No._4_2021_with_for_Case_42_Query_report_04_2021__#{test_time_s}.pdf"expect(attachment.filename).to eq expectedendend@@ -85,16 +88,13 @@ RSpec.describe WorkPackages::ExportJob, "Integration" dolet(:project) { create(:project, name: "x" * 255) }it "exports the job correctly, limiting the result file length" do- time = DateTime.new(2023, 6, 30, 23, 59)- allow(DateTime).to receive(:now).and_return(time)-expect { performed_job }.not_to raise_errorexpect(job_status.status).to eq "success"attachment = export.attachments.lastexpect(attachment.filename.length).to eq 255- expect(attachment.filename).to end_with "_2023-06-30_23-59.pdf"+ expect(attachment.filename).to end_with "_#{test_time_s}.pdf"endendend