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

at_timestamp: adding spec for sub queries

Sebastian Fiedlschusterfac374ef86ae
diff --git a/spec/models/journable/timestamps_spec.rb b/spec/models/journable/timestamps_spec.rb
index ebe6d8c83e8..217376b275d 100644
--- a/spec/models/journable/timestamps_spec.rb
+++ b/spec/models/journable/timestamps_spec.rb
@@ -386,6 +386,25 @@ describe Journable::Timestamps, type: :model do
end
end
+ describe "when using historic queries as sub queries" do
+ subject do
+ sub_query = WorkPackage.at_timestamp(@monday).where(description: "The work package as it has been on Monday")
+ WorkPackage.where(id: sub_query)
+ end
+ pending "returns the current records that have matched the filter on monday" do
+ expect(subject.pluck(:description)).to eq ["The work package as it is since Friday"]
+ end
+ describe "when plucking the id as sub query (workaround)" do
+ subject do
+ sub_query = WorkPackage.at_timestamp(@monday).where(description: "The work package as it has been on Monday").pluck(:id)
+ WorkPackage.where(id: sub_query)
+ end
+ it "returns the current records that have matched the filter on monday" do
+ expect(subject.pluck(:description)).to eq ["The work package as it is since Friday"]
+ end
+ end
+ end
+
end
describe "#at_timestamp" do