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
Query#timestamps: add specs for retrieving historic state of results
Sebastian Fiedlschustercadd26e6fe4b
diff --git a/spec/models/query/results_filter_on_historic_data_spec.rb b/spec/models/query/results_filter_on_historic_data_spec.rbindex f767d79a51c..10b0835c6f8 100644--- a/spec/models/query/results_filter_on_historic_data_spec.rb+++ b/spec/models/query/results_filter_on_historic_data_spec.rb@@ -157,10 +157,30 @@ describe ::Query::Results, 'Filter on historic data', with_mail: false doenddescribe "when chaining at_timestamp" do- subject { WorkPackage.at_timestamp(historic_time).where(id: results.work_packages.pluck(:id)) }+ # https://github.com/opf/openproject/pull/11678#issuecomment-1324244907- it "returns the work packages in their historic states" do- expect(subject.first.description).to eq "This is the original description of the work package"+ describe "directly" do+ subject { results.work_packages.at_timestamp(historic_time) }++ it "returns the work packages in their historic states" do+ expect(subject.first.description).to eq "This is the original description of the work package"+ end+ end++ describe "using a subquery" do+ subject { WorkPackage.where(id: results.work_packages).at_timestamp(historic_time) }++ it "returns the work packages in their historic states" do+ expect(subject.first.description).to eq "This is the original description of the work package"+ end+ end++ describe "using a pluck-id workaround" do+ subject { WorkPackage.where(id: results.work_packages.pluck(:id)).at_timestamp(historic_time) }++ it "returns the work packages in their historic states" do+ expect(subject.first.description).to eq "This is the original description of the work package"+ endendendend