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: adding spec with several work packages
Sebastian Fiedlschusterf3e41a7a5c17
diff --git a/spec/models/query/results_filter_on_historic_data_spec.rb b/spec/models/query/results_filter_on_historic_data_spec.rbindex c3873a64076..f767d79a51c 100644--- a/spec/models/query/results_filter_on_historic_data_spec.rb+++ b/spec/models/query/results_filter_on_historic_data_spec.rb@@ -44,6 +44,18 @@ describe ::Query::Results, 'Filter on historic data', with_mail: false donew_work_packageend+ let!(:work_package2) do+ new_work_package = create(:work_package, description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit",+ project: project1)+ new_work_package.update_columns created_at: historic_time+ new_work_package.journals.first.update_columns created_at: historic_time, updated_at: historic_time+ new_work_package.reload+ new_work_package.update description: "Lorem ipsum", updated_at: recent_time+ new_work_package.journals.last.update_columns created_at: recent_time, updated_at: recent_time+ new_work_package.reload+ new_work_package+ end+let(:project1) { create(:project) }let(:user1) docreate(:user,@@ -80,7 +92,7 @@ describe ::Query::Results, 'Filter on historic data', with_mail: false dolet(:search_term) { 'current' }it "includes the work package matching today" do- expect(subject).to include work_package+ expect(subject).to eq [work_package]endend@@ -88,7 +100,7 @@ describe ::Query::Results, 'Filter on historic data', with_mail: false dolet(:search_term) { 'original' }it "does not include the work package matching only in the past" do- expect(subject).not_to include work_package+ expect(subject).not_to eq [work_package]endend@@ -99,7 +111,7 @@ describe ::Query::Results, 'Filter on historic data', with_mail: false dolet(:search_term) { 'current' }it "includes the work package matching today" do- expect(subject).to include work_package+ expect(subject).to eq [work_package]endend@@ -107,11 +119,21 @@ describe ::Query::Results, 'Filter on historic data', with_mail: false dolet(:search_term) { 'original' }it "includes the work package matching in the past" do- expect(subject).to include work_package+ expect(subject).to eq [work_package]endendend+ describe "when the search matches several work packages" do+ before { query.timestamps = [historic_time, Time.zone.now] }++ let(:search_term) { 're' }++ it "includes all matching work packages" do+ expect(subject).to include work_package, work_package2+ end+ end+describe "when searching only historic work packages" dobefore { query.timestamps = [historic_time] }