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
rename stage to phase in specs
ulfertse5f977afe0b2
diff --git a/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rb b/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rbindex 9a578437036..824f7da7def 100644--- a/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rb+++ b/spec/models/queries/projects/project_query_results_project_phase_gate_spec.rb@@ -309,14 +309,14 @@ RSpec.describe ProjectQuery, "results of a project phase gate filter" dogate.update_column(:"#{boundary}_date", Date.parse("2025-03-02"))end- it "returns no project as the stage ended in the week before" do+ it "returns no project as the gate is in the week before" doTimecop.travel(Date.parse("2025-03-03").noon) doexpect(instance.results).to be_emptyendendend- context "when being on Sunday, the gate is on Monday and the week is configured to start on Monday",+ context "when being on Sunday after the gate, the gate is on Monday and the week is configured to start on Monday",with_settings: { start_of_week: 1 } dobefore do# This might produce invalid phases where the start date is after the end date.@@ -339,7 +339,7 @@ RSpec.describe ProjectQuery, "results of a project phase gate filter" dogate.update_column(:"#{boundary}_date", Date.parse("2025-03-03"))end- it "returns no project as the stage ended in the week before" do+ it "returns no project as the gate is in the week before" doTimecop.travel(Date.parse("2025-03-09").noon) doexpect(instance.results).to be_emptyenddiff --git a/spec/models/queries/projects/project_query_results_project_phase_spec.rb b/spec/models/queries/projects/project_query_results_project_phase_spec.rbindex de1b7fd3c2d..0d34291fd59 100644--- a/spec/models/queries/projects/project_query_results_project_phase_spec.rb+++ b/spec/models/queries/projects/project_query_results_project_phase_spec.rb@@ -32,20 +32,20 @@ require "spec_helper"RSpec.describe ProjectQuery, "results of a project phase filter" dolet(:instance) { described_class.new }- let(:filter_key) { "project_phase_#{stage.definition_id}" }+ let(:filter_key) { "project_phase_#{phase.definition_id}" }shared_let(:view_role) { create(:project_role, permissions: %i[view_project_phases]) }shared_let(:phase_start_date) { Date.parse("2025-02-07") }shared_let(:phase_finish_date) { Date.parse("2025-02-17") }- shared_let(:project_with_phase) { create(:project, name: "Project with stage") }- shared_let(:stage) do+ shared_let(:project_with_phase) { create(:project, name: "Project with phase") }+ shared_let(:phase) docreate(:project_phase, project: project_with_phase, start_date: phase_start_date, finish_date: phase_finish_date)end- # This is added to ensure that the filter only works on the stage provided.- shared_let(:project_with_rival_phase) { create(:project, name: "Project with rival stage") }- shared_let(:rival_stage) do+ # This is added to ensure that the filter only works on the phase provided.+ shared_let(:project_with_rival_phase) { create(:project, name: "Project with rival phase") }+ shared_let(:rival_phase) docreate(:project_phase, project: project_with_rival_phase, start_date: phase_start_date, finish_date: phase_finish_date)end@@ -70,7 +70,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" dodef self.remove_phase_datesbefore do- stage.update_columns(finish_date: nil, start_date: nil)+ phase.update_columns(finish_date: nil, start_date: nil)endend@@ -92,31 +92,31 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doinstance.where(filter_key, "=d", values)end- context "when filtering in the middle of the stage" do+ context "when filtering in the middle of the phase" dolet(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }- it "returns the project whose stage is covering an interval including the date" do+ it "returns the project whose phase is covering an interval including the date" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when filtering on the first day of the stage" do+ context "when filtering on the first day of the phase" dolet(:values) { [phase_start_date.to_s] }- it "returns the project whose stage begins on that date" do+ it "returns the project whose phase begins on that date" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when filtering on the last day of the stage" do+ context "when filtering on the last day of the phase" dolet(:values) { [phase_finish_date.to_s] }- it "returns the project whose stage ends on that date" do+ it "returns the project whose phase ends on that date" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when filtering before the stage" do+ context "when filtering before the phase" dolet(:values) { [(phase_start_date - 1.day).to_s] }it "returns no project" do@@ -124,7 +124,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when filtering after the stage" do+ context "when filtering after the phase" dolet(:values) { [(phase_finish_date + 1.day).to_s] }it "returns no project" do@@ -132,7 +132,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when the stage has no dates" do+ context "when the phase has no dates" dolet(:values) { [phase_finish_date.to_s] }remove_phase_dates@@ -142,7 +142,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when filtering in the middle of the stage but with the stage being inactive" do+ context "when filtering in the middle of the phase but with the phase being inactive" dolet(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }disable_phase@@ -152,7 +152,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when filtering in the middle of the stage but without permissions" do+ context "when filtering in the middle of the phase but without permissions" dolet(:values) { [(phase_start_date + ((phase_finish_date - phase_start_date) / 2)).to_s] }remove_permissions@@ -168,31 +168,31 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doinstance.where(filter_key, "t", [])end- context "when being in the middle of the stage" do- it "returns the project whose stage is currently running" do+ context "when being in the middle of the phase" do+ it "returns the project whose phase is currently running" doTimecop.travel((phase_start_date + (phase_finish_date - phase_start_date)).noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when being on the first day of the stage" do- it "returns the project whose stage begins on that date" do+ context "when being on the first day of the phase" do+ it "returns the project whose phase begins on that date" doTimecop.travel(phase_start_date.noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when being on the last day of the stage" do- it "returns the project whose stage begins on that date" do+ context "when being on the last day of the phase" do+ it "returns the project whose phase begins on that date" doTimecop.travel(phase_finish_date.noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when being before the stage" do+ context "when being before the phase" doit "returns no project" doTimecop.travel(phase_start_date.noon - 1.day) doexpect(instance.results).to be_empty@@ -200,7 +200,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when being after the stage" do+ context "when being after the phase" doit "returns no project" doTimecop.travel(phase_finish_date.noon + 1.day) doexpect(instance.results).to be_empty@@ -208,7 +208,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when the stage has no dates" do+ context "when the phase has no dates" doremove_phase_datesit "returns no project" do@@ -216,7 +216,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when being in the middle of the stage but with the stage being disabled" do+ context "when being in the middle of the phase but with the phase being disabled" dodisable_phaseit "returns no project" do@@ -226,7 +226,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when being in the middle of the stage but without permissions" do+ context "when being in the middle of the phase but without permissions" doremove_permissionsit "returns no project" do@@ -242,31 +242,31 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doinstance.where(filter_key, "w", [])end- context "when being in the middle of the stage" do- it "returns the project whose stage is currently running" do+ context "when being in the middle of the phase" do+ it "returns the project whose phase is currently running" doTimecop.travel((phase_start_date + 3.days).noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when the current week overlaps the beginning of the stage" do- it "returns the project whose stage begins within the week" do+ context "when the current week overlaps the beginning of the phase" do+ it "returns the project whose phase begins within the week" doTimecop.travel((phase_start_date - 1.day).noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when the current week overlaps the end of the stage" do- it "returns the project whose stage begins within the week" do+ context "when the current week overlaps the end of the phase" do+ it "returns the project whose phase begins within the week" doTimecop.travel(phase_finish_date.noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when being before the stage" do+ context "when being before the phase" doit "returns no project" doTimecop.travel(phase_start_date.noon - 7.days) doexpect(instance.results).to be_empty@@ -274,7 +274,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when being after the stage" do+ context "when being after the phase" doit "returns no project" doTimecop.travel(phase_finish_date.noon + 7.days) doexpect(instance.results).to be_empty@@ -282,7 +282,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when the stage has no dates" do+ context "when the phase has no dates" doremove_phase_datesit "returns no project" do@@ -292,7 +292,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when being in the middle of the stage but with the stage disabled" do+ context "when being in the middle of the phase but with the phase disabled" dodisable_phaseit "returns no project" do@@ -302,7 +302,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when being in the middle of the stage but without permissions" do+ context "when being in the middle of the phase but without permissions" doremove_permissionsit "returns no project" do@@ -312,52 +312,52 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when being on Monday, the stage ends on Sunday and the week is configured to start on Sunday",+ context "when being on Monday, the phase ends on Sunday and the week is configured to start on Sunday",with_settings: { start_of_week: 7 } dobefore do- stage.update_column(:finish_date, Date.parse("2025-02-16"))+ phase.update_column(:finish_date, Date.parse("2025-02-16"))end- it "returns the project whose stage has ended within the current week" do+ it "returns the project whose phase has ended within the current week" doTimecop.travel(Date.parse("2025-02-17").noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when being on Monday, the stage ends on Sunday and the week is configured to start on Monday",+ context "when being on Monday, the phase ends on Sunday and the week is configured to start on Monday",with_settings: { start_of_week: 1 } dobefore do- stage.update_column(:finish_date, Date.parse("2025-02-16"))+ phase.update_column(:finish_date, Date.parse("2025-02-16"))end- it "returns no project as the stage ended in the week before" do+ it "returns no project as the phase ended in the week before" doTimecop.travel(Date.parse("2025-02-17").noon) doexpect(instance.results).to be_emptyendendend- context "when being on Sunday, the stage ends on Monday and the week is configured to start on Monday",+ context "when being on Sunday, the phase ends on Monday and the week is configured to start on Monday",with_settings: { start_of_week: 1 } dobefore do- stage.update_column(:finish_date, Date.parse("2025-02-17"))+ phase.update_column(:finish_date, Date.parse("2025-02-17"))end- it "returns the project whose stage has ended within the current week" do+ it "returns the project whose phase has ended within the current week" doTimecop.travel(Date.parse("2025-02-23").noon) doexpect(instance.results).to contain_exactly(project_with_phase)endendend- context "when being on Sunday, the stage ends on Monday and the week is configured to start on Sunday",+ context "when being on Sunday, the phase ends on Monday and the week is configured to start on Sunday",with_settings: { start_of_week: 7 } dobefore do- stage.update_column(:finish_date, Date.parse("2025-02-17"))+ phase.update_column(:finish_date, Date.parse("2025-02-17"))end- it "returns no project as the stage ended in the week before" do+ it "returns no project as the phase ended in the week before" doTimecop.travel(Date.parse("2025-02-23").noon) doexpect(instance.results).to be_emptyend@@ -367,7 +367,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" docontext "when being on Wednesday before the phase, the phase starts on Monday and the week is configured to start on Monday",with_settings: { start_of_week: 1 } dobefore do- stage.update_column(:start_date, Date.parse("2025-02-03"))+ phase.update_column(:start_date, Date.parse("2025-02-03"))endit "returns no project as the phase starts in the next week" do@@ -396,23 +396,23 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doinstance.where(filter_key, "<>d", values)end- context "when encompassing the stage completely" do+ context "when encompassing the phase completely" dolet(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }- it "returns the project with the stage" do+ it "returns the project with the phase" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when encompassing the stage precisely" do+ context "when encompassing the phase precisely" dolet(:values) { [phase_start_date.to_s, phase_finish_date.to_s] }- it "returns the project with the stage" do+ it "returns the project with the phase" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when the values overlap the stage's start date but not the end date" do+ context "when the values overlap the phase's start date but not the end date" dolet(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date - 1.day).to_s] }it "returns no project" do@@ -420,7 +420,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when the values overlap the stage's end date but not the start date" do+ context "when the values overlap the phase's end date but not the start date" dolet(:values) { [(phase_start_date + 1.day).to_s, phase_finish_date.to_s] }it "returns no project" do@@ -428,7 +428,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when the values are between the start and the end date of the stage" do+ context "when the values are between the start and the end date of the phase" dolet(:values) { [(phase_start_date + 1.day).to_s, (phase_finish_date - 1.day).to_s] }it "returns no project" do@@ -436,23 +436,23 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when only the lower value is provided and that one is before the stage's start date" do+ context "when only the lower value is provided and that one is before the phase's start date" dolet(:values) { [(phase_start_date - 1.day).to_s, ""] }- it "returns the project with the stage" do+ it "returns the project with the phase" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when only the lower value is provided and that one is on the stage's start date" do+ context "when only the lower value is provided and that one is on the phase's start date" dolet(:values) { [phase_start_date.to_s, ""] }- it "returns the project with the stage" do+ it "returns the project with the phase" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when only the lower value is provided and that one after the stage's start date" do+ context "when only the lower value is provided and that one after the phase's start date" dolet(:values) { [(phase_start_date + 1.day).to_s, ""] }it "returns no project" do@@ -460,15 +460,15 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when only the upper value is provided and that one is after the stage's end date" do+ context "when only the upper value is provided and that one is after the phase's end date" dolet(:values) { ["", (phase_finish_date + 1.day).to_s] }- it "returns the project with the stage" do+ it "returns the project with the phase" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when the stage has no dates" do+ context "when the phase has no dates" dolet(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }remove_phase_dates@@ -486,7 +486,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when encompassing the stage completely but with the stage disabled" do+ context "when encompassing the phase completely but with the phase disabled" dolet(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }disable_phase@@ -496,7 +496,7 @@ RSpec.describe ProjectQuery, "results of a project phase filter" doendend- context "when encompassing the stage completely but without permissions" do+ context "when encompassing the phase completely but without permissions" dolet(:values) { [(phase_start_date - 1.day).to_s, (phase_finish_date + 1.day).to_s] }remove_permissions@@ -515,18 +515,18 @@ RSpec.describe ProjectQuery, "results of a project phase filter" docontext "when the phase is active but has no dates" doremove_phase_dates- it "returns the project with the stage" do+ it "returns the project with the phase" doexpect(instance.results).to contain_exactly(project_with_phase)endend- context "when the stage is active and has dates" do+ context "when the phase is active and has dates" doit "returns no project" doexpect(instance.results).to be_emptyendend- context "when the stage is inactive and has no dates" do+ context "when the phase is inactive and has no dates" doremove_phase_datesdisable_phase