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

remove stages_and_gates usage from specs

Ivan Kuchinede5e5be1496
diff --git a/spec/contracts/work_packages/shared_base_contract.rb b/spec/contracts/work_packages/shared_base_contract.rb
index ce47fc79d45..9d38a5260bb 100644
--- a/spec/contracts/work_packages/shared_base_contract.rb
+++ b/spec/contracts/work_packages/shared_base_contract.rb
@@ -200,7 +200,7 @@ RSpec.shared_examples "work package contract" do
end
end
- describe "project_phase_definition", with_flag: { stages_and_gates: true } do
+ describe "project_phase_definition" do
let(:permissions) { super() + %i[view_project_phases] }
before do
@@ -232,10 +232,6 @@ RSpec.shared_examples "work package contract" do
it_behaves_like "contract is invalid", project_phase_id: :inclusion
end
-
- context "with the feature being disabled", with_flag: { stages_and_gates: false } do
- it_behaves_like "contract is invalid", project_phase_id: :error_readonly
- end
end
end
diff --git a/spec/contracts/work_packages/update_contract_spec.rb b/spec/contracts/work_packages/update_contract_spec.rb
index c45e0cb50a9..1a7bfd3e987 100644
--- a/spec/contracts/work_packages/update_contract_spec.rb
+++ b/spec/contracts/work_packages/update_contract_spec.rb
@@ -327,7 +327,7 @@ RSpec.describe WorkPackages::UpdateContract do
end
end
- describe "project_phase_definition", with_flag: { stages_and_gates: true } do
+ describe "project_phase_definition" do
let(:permissions) { super() + %i[view_project_phases move_work_packages] }
context "when not changing the value but assigning a project in which the phase is not active" do
diff --git a/spec/features/admin/project_phase_definitions_spec.rb b/spec/features/admin/project_phase_definitions_spec.rb
index b0b222170d0..e3100a423e2 100644
--- a/spec/features/admin/project_phase_definitions_spec.rb
+++ b/spec/features/admin/project_phase_definitions_spec.rb
@@ -30,7 +30,7 @@
require "spec_helper"
-RSpec.describe "Projects phase definition settings", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Projects phase definition settings", :js do
shared_let(:initiating_stage) { create(:project_phase_definition, name: "Initiating") }
shared_let(:executing_stage) do
create(:project_phase_definition, name: "Executing", start_gate: true, start_gate_name: "Ready to Execute")
@@ -62,21 +62,6 @@ RSpec.describe "Projects phase definition settings", :js, with_flag: { stages_an
end
end
- context "as admin without feature flag", with_flag: { stages_and_gates: false } do
- current_user { create(:admin) }
-
- it "allows viewing definitions" do
- definitions_page.visit!
-
- definitions_page.expect_listed([])
-
- definitions_page.expect_flash(
- message: "[Error 404] The page you were trying to access doesn't exist or has been removed.",
- type: :error
- )
- end
- end
-
context "as admin with activated enterprise token", with_ee: %i[customize_life_cycle] do
current_user { create(:admin) }
diff --git a/spec/features/projects/life_cycle/active_in_project_spec.rb b/spec/features/projects/life_cycle/active_in_project_spec.rb
index 86eb1c5afa5..584dc081326 100644
--- a/spec/features/projects/life_cycle/active_in_project_spec.rb
+++ b/spec/features/projects/life_cycle/active_in_project_spec.rb
@@ -30,7 +30,7 @@
require "spec_helper"
-RSpec.describe "Projects life cycle settings", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Projects life cycle settings", :js do
shared_let(:project) { create(:project) }
shared_let(:user_with_permission) do
diff --git a/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb b/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb
index 8c67e50c0aa..71f842c1000 100644
--- a/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb
+++ b/spec/features/projects/life_cycle/overview_page/dialog/permission_spec.rb
@@ -31,7 +31,7 @@
require "spec_helper"
require_relative "../shared_context"
-RSpec.describe "Edit project phases on project overview page", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Edit project phases on project overview page", :js do
include_context "with seeded projects and phases"
shared_let(:user) { create(:user) }
let(:overview_page) { Pages::Projects::Show.new(project) }
diff --git a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
index 31d676359cc..01b32cfdd82 100644
--- a/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
+++ b/spec/features/projects/life_cycle/overview_page/dialog/update_spec.rb
@@ -31,7 +31,7 @@
require "spec_helper"
require_relative "../shared_context"
-RSpec.describe "Edit project phases on project overview page", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Edit project phases on project overview page", :js do
include_context "with seeded projects and phases"
shared_let(:overview) { create :overview, project: }
diff --git a/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb b/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb
index 473413efc26..6b975a7c6e5 100644
--- a/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb
+++ b/spec/features/projects/life_cycle/overview_page/sidebar_spec.rb
@@ -31,7 +31,7 @@
require "spec_helper"
require_relative "shared_context"
-RSpec.describe "Show project life cycles on project overview page", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Show project life cycles on project overview page", :js do
include_context "with seeded projects and phases"
let(:overview_page) { Pages::Projects::Show.new(project) }
@@ -43,13 +43,6 @@ RSpec.describe "Show project life cycles on project overview page", :js, with_fl
overview_page.expect_visible_sidebar
end
- context "when phases are disabled", with_flag: { stages_and_gates: false } do
- it "does not show the sidebar" do
- overview_page.visit_page
- overview_page.expect_no_visible_sidebar
- end
- end
-
context "when all phases are disabled for this project" do
before do
project_life_cycles.each { |p| p.toggle!(:active) }
diff --git a/spec/features/projects/lists/columns_spec.rb b/spec/features/projects/lists/columns_spec.rb
index d1d38686826..cf737b2209f 100644
--- a/spec/features/projects/lists/columns_spec.rb
+++ b/spec/features/projects/lists/columns_spec.rb
@@ -274,53 +274,104 @@ RSpec.describe "Projects lists columns", :js, with_settings: { login_required?:
end
shared_let(:inactive_project_phase) { create(:project_phase, project: development_project, active: false) }
- context "with the feature flag disabled", with_flag: { stages_and_gates: false } do
- specify "project phase columns cannot be configured to show up" do
+ context "with an admin" do
+ before do
login_as(admin)
projects_page.visit!
+ end
- element_selector = "#columns-select_autocompleter ng-select.op-draggable-autocomplete--input"
- results_selector = "#columns-select_autocompleter ng-dropdown-panel .ng-dropdown-panel-items"
- projects_page.expect_no_config_columns(project_phase_with_gates.start_gate_name,
- project_phase_with_gates.finish_gate_name,
- project_phase.name,
- inactive_project_phase_with_gates.name,
- inactive_project_phase.name,
- element_selector:,
- results_selector:)
+ specify "configuring project phase column display" do
+ # project phase columns do not show up by default
+ projects_page.expect_columns("Name")
+ projects_page.expect_no_columns(project_phase_with_gates.finish_gate_name,
+ project_phase_with_gates.start_gate_name,
+ project_phase_with_gates.name,
+ project_phase.name,
+ inactive_project_phase.name)
+
+ # project phase columns show up when configured to do so
+ # Configuring columns specifically for gates is not supported.
+ # Phases inactive or not in a single project, can be added.
+ projects_page.set_columns(project_phase.name,
+ project_phase_with_gates.name,
+ inactive_project_phase.name)
+
+ projects_page.expect_columns("Name",
+ project_phase_with_gates.name,
+ project_phase.name,
+ inactive_project_phase.name)
+ end
+
+ specify "inactive project phase columns have no cell content" do
+ col_names = [project_phase_with_gates,
+ project_phase,
+ inactive_project_phase_with_gates,
+ inactive_project_phase].collect(&:name)
+
+ projects_page.set_columns(*col_names)
+ # Inactive columns are still displayed in the header:
+ projects_page.expect_columns("Name", *col_names)
+
+ projects_page.within_row(development_project) do
+ expect(page).to have_css(".name", text: development_project.name)
+ expect(page).to have_css(".project_phase_#{project_phase_with_gates.definition_id}",
+ text: "12/01/2024\n-\n12/13/2024")
+ # project phase assigned to other project, no text here
+ expect(page).to have_css(".project_phase_#{project_phase.definition_id}", text: "")
+ # inactive project phases, no text here
+ expect(page).to have_css(".project_phase_#{inactive_project_phase.definition_id}", text: "")
+ expect(page).to have_css(".project_phase_#{inactive_project_phase_with_gates.definition_id}", text: "")
+ end
+
+ projects_page.within_row(project) do
+ expect(page).to have_css(".name", text: project.name)
+ expect(page).to have_css(".project_phase_#{project_phase.definition_id}",
+ text: "12/01/2024\n-\n12/13/2024")
+ # project phase assigned to other project, no text here
+ expect(page).to have_css(".project_phase_#{project_phase_with_gates.definition_id}", text: "")
+ # inactive project phases, no text here
+ expect(page).to have_css(".project_phase_#{inactive_project_phase.definition_id}", text: "")
+ expect(page).to have_css(".project_phase_#{inactive_project_phase_with_gates.definition_id}", text: "")
+ end
end
end
- context "with the feature flag enabled", with_flag: { stages_and_gates: true } do
- context "with an admin" do
- before do
- login_as(admin)
- projects_page.visit!
+ context "with a user" do
+ let(:permissions) { %i(view_project) }
+ let(:user) do
+ create(:user, member_with_permissions: { development_project => permissions,
+ project => %i(view_project) })
+ end
+
+ before do
+ login_as(user)
+ projects_page.visit!
+ end
+
+ context "for users without view_project_phases permission" do
+ specify "project phase columns cannot be configured to show up" do
+ element_selector = "#columns-select_autocompleter ng-select.op-draggable-autocomplete--input"
+ results_selector = "#columns-select_autocompleter ng-dropdown-panel .ng-dropdown-panel-items"
+ projects_page.expect_no_config_columns(project_phase_with_gates.name,
+ project_phase.name,
+ inactive_project_phase_with_gates.name,
+ inactive_project_phase.name,
+ element_selector:,
+ results_selector:)
end
+ end
- specify "configuring project phase column display" do
- # project phase columns do not show up by default
+ context "for users with view_project_phases permission" do
+ let(:permissions) { %i(view_project view_project_phases) }
+
+ specify "project phase columns show up when configured to do so" do
projects_page.expect_columns("Name")
- projects_page.expect_no_columns(project_phase_with_gates.finish_gate_name,
- project_phase_with_gates.start_gate_name,
- project_phase_with_gates.name,
- project_phase.name,
- inactive_project_phase.name)
-
- # project phase columns show up when configured to do so
- # Configuring columns specifically for gates is not supported.
- # Phases inactive or not in a single project, can be added.
- projects_page.set_columns(project_phase.name,
- project_phase_with_gates.name,
- inactive_project_phase.name)
-
- projects_page.expect_columns("Name",
- project_phase_with_gates.name,
- project_phase.name,
- inactive_project_phase.name)
+ projects_page.set_columns(project_phase_with_gates.name)
+
+ expect(page).to have_text(project_phase_with_gates.name.upcase)
end
- specify "inactive project phase columns have no cell content" do
+ specify "not permitted project phase columns have no cell content" do
col_names = [project_phase_with_gates,
project_phase,
inactive_project_phase_with_gates,
@@ -341,79 +392,9 @@ RSpec.describe "Projects lists columns", :js, with_settings: { login_required?:
expect(page).to have_css(".project_phase_#{inactive_project_phase_with_gates.definition_id}", text: "")
end
+ # Not permitted project phase steps never show their date values
projects_page.within_row(project) do
- expect(page).to have_css(".name", text: project.name)
- expect(page).to have_css(".project_phase_#{project_phase.definition_id}",
- text: "12/01/2024\n-\n12/13/2024")
- # project phase assigned to other project, no text here
- expect(page).to have_css(".project_phase_#{project_phase_with_gates.definition_id}", text: "")
- # inactive project phases, no text here
- expect(page).to have_css(".project_phase_#{inactive_project_phase.definition_id}", text: "")
- expect(page).to have_css(".project_phase_#{inactive_project_phase_with_gates.definition_id}", text: "")
- end
- end
- end
-
- context "with a user" do
- let(:permissions) { %i(view_project) }
- let(:user) do
- create(:user, member_with_permissions: { development_project => permissions,
- project => %i(view_project) })
- end
-
- before do
- login_as(user)
- projects_page.visit!
- end
-
- context "for users without view_project_phases permission" do
- specify "project phase columns cannot be configured to show up" do
- element_selector = "#columns-select_autocompleter ng-select.op-draggable-autocomplete--input"
- results_selector = "#columns-select_autocompleter ng-dropdown-panel .ng-dropdown-panel-items"
- projects_page.expect_no_config_columns(project_phase_with_gates.name,
- project_phase.name,
- inactive_project_phase_with_gates.name,
- inactive_project_phase.name,
- element_selector:,
- results_selector:)
- end
- end
-
- context "for users with view_project_phases permission" do
- let(:permissions) { %i(view_project view_project_phases) }
-
- specify "project phase columns show up when configured to do so" do
- projects_page.expect_columns("Name")
- projects_page.set_columns(project_phase_with_gates.name)
-
- expect(page).to have_text(project_phase_with_gates.name.upcase)
- end
-
- specify "not permitted project phase columns have no cell content" do
- col_names = [project_phase_with_gates,
- project_phase,
- inactive_project_phase_with_gates,
- inactive_project_phase].collect(&:name)
-
- projects_page.set_columns(*col_names)
- # Inactive columns are still displayed in the header:
- projects_page.expect_columns("Name", *col_names)
-
- projects_page.within_row(development_project) do
- expect(page).to have_css(".name", text: development_project.name)
- expect(page).to have_css(".project_phase_#{project_phase_with_gates.definition_id}",
- text: "12/01/2024\n-\n12/13/2024")
- # project phase assigned to other project, no text here
- expect(page).to have_css(".project_phase_#{project_phase.definition_id}", text: "")
- # inactive project phases, no text here
- expect(page).to have_css(".project_phase_#{inactive_project_phase.definition_id}", text: "")
- expect(page).to have_css(".project_phase_#{inactive_project_phase_with_gates.definition_id}", text: "")
- end
-
- # Not permitted project phase steps never show their date values
- projects_page.within_row(project) do
- expect(page).to have_css(".project_phase_#{project_phase.definition_id}", text: "")
- end
+ expect(page).to have_css(".project_phase_#{project_phase.definition_id}", text: "")
end
end
end
diff --git a/spec/features/projects/lists/filters_spec.rb b/spec/features/projects/lists/filters_spec.rb
index 3f1fd766004..4066ed562b6 100644
--- a/spec/features/projects/lists/filters_spec.rb
+++ b/spec/features/projects/lists/filters_spec.rb
@@ -673,248 +673,218 @@ RSpec.describe "Projects list filters", :js, with_settings: { login_required?: f
end
describe "filtering for any lifecycle step" do
- context "with the feature flag disabled", with_flag: { stages_and_gates: false } do
- it "does not have the lifecycle step (any) filter" do
- load_and_open_filters manager
-
- projects_page.expect_filter_not_available("Project phase: Any")
+ context "with the necessary permissions" do
+ before do
+ project_role.add_permission!(:view_project_phases)
end
- end
- context "with the feature flag enabled", with_flag: { stages_and_gates: true } do
- context "with the necessary permissions" do
- before do
- project_role.add_permission!(:view_project_phases)
- end
+ it "allows filtering the projects by project phase elements" do
+ load_and_open_filters manager
- it "allows filtering the projects by project phase elements" do
- load_and_open_filters manager
+ projects_page.expect_filter_available("Project phase: Any")
- projects_page.expect_filter_available("Project phase: Any")
+ projects_page.set_filter("project_phase_any",
+ "Project phase: Any",
+ "on",
+ [Time.zone.today])
- projects_page.set_filter("project_phase_any",
- "Project phase: Any",
- "on",
- [Time.zone.today])
+ projects_page.expect_projects_not_listed(development_project)
+ projects_page.expect_projects_in_order(project, public_project)
- projects_page.expect_projects_not_listed(development_project)
- projects_page.expect_projects_in_order(project, public_project)
+ projects_page.remove_filter("project_phase_any")
- projects_page.remove_filter("project_phase_any")
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.set_filter("project_phase_any",
+ "Project phase: Any",
+ "today")
- projects_page.set_filter("project_phase_any",
- "Project phase: Any",
- "today")
+ projects_page.expect_projects_not_listed(development_project)
+ projects_page.expect_projects_in_order(project, public_project)
- projects_page.expect_projects_not_listed(development_project)
- projects_page.expect_projects_in_order(project, public_project)
+ projects_page.remove_filter("project_phase_any")
- projects_page.remove_filter("project_phase_any")
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.set_filter("project_phase_any",
+ "Project phase: Any",
+ "between",
+ [Time.zone.today - 5.days, Time.zone.today + 10.days])
- projects_page.set_filter("project_phase_any",
- "Project phase: Any",
- "between",
- [Time.zone.today - 5.days, Time.zone.today + 10.days])
+ projects_page.expect_projects_not_listed(development_project)
+ projects_page.expect_projects_in_order(project, public_project)
- projects_page.expect_projects_not_listed(development_project)
- projects_page.expect_projects_in_order(project, public_project)
+ projects_page.remove_filter("project_phase_any")
- projects_page.remove_filter("project_phase_any")
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.set_filter("project_phase_any",
+ "Project phase: Any",
+ "this week")
- projects_page.set_filter("project_phase_any",
- "Project phase: Any",
- "this week")
+ projects_page.expect_projects_not_listed(development_project)
+ projects_page.expect_projects_in_order(project, public_project)
- projects_page.expect_projects_not_listed(development_project)
- projects_page.expect_projects_in_order(project, public_project)
+ projects_page.remove_filter("project_phase_any")
- projects_page.remove_filter("project_phase_any")
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.expect_projects_in_order(development_project, project, public_project)
-
- projects_page.set_filter("project_phase_any",
- "Project phase: Any",
- "is empty")
+ projects_page.set_filter("project_phase_any",
+ "Project phase: Any",
+ "is empty")
- projects_page.expect_projects_not_listed(public_project, development_project, project)
- end
+ projects_page.expect_projects_not_listed(public_project, development_project, project)
end
+ end
- context "without the necessary permissions" do
- it "does not have the lifecycle step (any) filter" do
- load_and_open_filters manager
+ context "without the necessary permissions" do
+ it "does not have the lifecycle step (any) filter" do
+ load_and_open_filters manager
- projects_page.expect_filter_not_available("Project phase: Any")
- end
+ projects_page.expect_filter_not_available("Project phase: Any")
end
end
end
describe "filtering for a specific lifecycle stage" do
- context "with the feature flag disabled", with_flag: { stages_and_gates: false } do
- it "does not have the lifecycle (specific stage) filter" do
- load_and_open_filters manager
-
- projects_page.expect_filter_not_available("Project phase: #{stage.name}")
+ context "with the necessary permissions" do
+ before do
+ project_role.add_permission!(:view_project_phases)
end
- end
- context "with the feature flag enabled", with_flag: { stages_and_gates: true } do
- context "with the necessary permissions" do
- before do
- project_role.add_permission!(:view_project_phases)
- end
-
- it "allows filtering the projects by the project phase stage" do
- load_and_open_filters manager
+ it "allows filtering the projects by the project phase stage" do
+ load_and_open_filters manager
- projects_page.set_filter("project_phase_#{stage.definition_id}",
- "Project phase: #{stage.name}",
- "on",
- [Time.zone.today + 5.days])
+ projects_page.set_filter("project_phase_#{stage.definition_id}",
+ "Project phase: #{stage.name}",
+ "on",
+ [Time.zone.today + 5.days])
- projects_page.expect_projects_not_listed(development_project, public_project)
- projects_page.expect_projects_in_order(project)
+ projects_page.expect_projects_not_listed(development_project, public_project)
+ projects_page.expect_projects_in_order(project)
- projects_page.remove_filter("project_phase_#{stage.definition_id}")
+ projects_page.remove_filter("project_phase_#{stage.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_phase_#{stage.definition_id}",
- "Project phase: #{stage.name}",
- "today")
+ projects_page.set_filter("project_phase_#{stage.definition_id}",
+ "Project phase: #{stage.name}",
+ "today")
- projects_page.expect_projects_not_listed(development_project, public_project)
- projects_page.expect_projects_in_order(project)
+ projects_page.expect_projects_not_listed(development_project, public_project)
+ projects_page.expect_projects_in_order(project)
- projects_page.remove_filter("project_phase_#{stage.definition_id}")
+ projects_page.remove_filter("project_phase_#{stage.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_phase_#{stage.definition_id}",
- "Project phase: #{stage.name}",
- "between",
- [Time.zone.today - 5.days, Time.zone.today + 10.days])
+ projects_page.set_filter("project_phase_#{stage.definition_id}",
+ "Project phase: #{stage.name}",
+ "between",
+ [Time.zone.today - 5.days, Time.zone.today + 10.days])
- projects_page.expect_projects_not_listed(development_project, public_project)
- projects_page.expect_projects_in_order(project)
+ projects_page.expect_projects_not_listed(development_project, public_project)
+ projects_page.expect_projects_in_order(project)
- projects_page.remove_filter("project_phase_#{stage.definition_id}")
+ projects_page.remove_filter("project_phase_#{stage.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_phase_#{stage.definition_id}",
- "Project phase: #{stage.name}",
- "this week")
+ projects_page.set_filter("project_phase_#{stage.definition_id}",
+ "Project phase: #{stage.name}",
+ "this week")
- projects_page.expect_projects_not_listed(development_project, public_project)
- projects_page.expect_projects_in_order(project)
+ projects_page.expect_projects_not_listed(development_project, public_project)
+ projects_page.expect_projects_in_order(project)
- projects_page.remove_filter("project_phase_#{stage.definition_id}")
+ projects_page.remove_filter("project_phase_#{stage.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_phase_#{stage.definition_id}",
- "Project phase: #{stage.name}",
- "is empty")
+ projects_page.set_filter("project_phase_#{stage.definition_id}",
+ "Project phase: #{stage.name}",
+ "is empty")
- projects_page.expect_projects_not_listed(public_project, development_project, project)
- end
+ projects_page.expect_projects_not_listed(public_project, development_project, project)
end
+ end
- context "without the necessary permissions" do
- it "does not have the lifecycle (specific stage) filter" do
- load_and_open_filters manager
+ context "without the necessary permissions" do
+ it "does not have the lifecycle (specific stage) filter" do
+ load_and_open_filters manager
- projects_page.expect_filter_not_available("Project phase: #{stage.name}")
- end
+ projects_page.expect_filter_not_available("Project phase: #{stage.name}")
end
end
describe "filtering for a specific Project phase gate" do
- context "with the feature flag disabled", with_flag: { stages_and_gates: false } do
- it "does not have the lifecycle (specific gate) filter" do
- load_and_open_filters manager
-
- projects_page.expect_filter_not_available("Project phase gate: #{gate.name}")
+ context "with the necessary permissions" do
+ before do
+ project_role.add_permission!(:view_project_phases)
end
- end
- context "with the feature flag enabled", with_flag: { stages_and_gates: true } do
- context "with the necessary permissions" do
- before do
- project_role.add_permission!(:view_project_phases)
- end
-
- it "allows filtering the projects by the project phase gate" do
- load_and_open_filters manager
+ it "allows filtering the projects by the project phase gate" do
+ load_and_open_filters manager
- projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.finish_gate_name}",
- "on",
- [Time.zone.today])
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
+ "on",
+ [Time.zone.today])
- projects_page.expect_projects_not_listed(development_project, project)
- projects_page.expect_projects_in_order(public_project)
+ projects_page.expect_projects_not_listed(development_project, project)
+ projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.finish_gate_name}",
- "today")
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
+ "today")
- projects_page.expect_projects_not_listed(development_project, project)
- projects_page.expect_projects_in_order(public_project)
+ projects_page.expect_projects_not_listed(development_project, project)
+ projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.finish_gate_name}",
- "between",
- [Time.zone.today - 5.days, Time.zone.today + 10.days])
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
+ "between",
+ [Time.zone.today - 5.days, Time.zone.today + 10.days])
- projects_page.expect_projects_not_listed(development_project, project)
- projects_page.expect_projects_in_order(public_project)
+ projects_page.expect_projects_not_listed(development_project, project)
+ projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.finish_gate_name}",
- "this week")
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
+ "this week")
- projects_page.expect_projects_not_listed(development_project, project)
- projects_page.expect_projects_in_order(public_project)
+ projects_page.expect_projects_not_listed(development_project, project)
+ projects_page.expect_projects_in_order(public_project)
- projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
+ projects_page.remove_filter("project_finish_gate_#{gate.definition_id}")
- projects_page.expect_projects_in_order(development_project, project, public_project)
+ projects_page.expect_projects_in_order(development_project, project, public_project)
- projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
- "Project phase gate: #{gate.finish_gate_name}",
- "is empty")
+ projects_page.set_filter("project_finish_gate_#{gate.definition_id}",
+ "Project phase gate: #{gate.finish_gate_name}",
+ "is empty")
- projects_page.expect_projects_not_listed(public_project, development_project, project)
- end
+ projects_page.expect_projects_not_listed(public_project, development_project, project)
end
+ end
- context "without the necessary permissions" do
- it "does not have the lifecycle (specific gate) filter" do
- load_and_open_filters manager
+ context "without the necessary permissions" do
+ it "does not have the lifecycle (specific gate) filter" do
+ load_and_open_filters manager
- projects_page.expect_filter_not_available("Project phase gate: #{gate.name}")
- end
+ projects_page.expect_filter_not_available("Project phase gate: #{gate.name}")
end
end
end
diff --git a/spec/features/projects/lists/order_spec.rb b/spec/features/projects/lists/order_spec.rb
index 7bc83a7d6a3..ec8bc789826 100644
--- a/spec/features/projects/lists/order_spec.rb
+++ b/spec/features/projects/lists/order_spec.rb
@@ -273,7 +273,7 @@ RSpec.describe "Projects lists ordering", :js, with_settings: { login_required?:
projects_page.expect_project_at_place(project, 1)
end
- context "when sorting by project phase", with_flag: { stages_and_gates: true } do
+ context "when sorting by project phase" do
let(:stage_def) { create(:project_phase_definition) }
let(:stage) do
create(:project_phase,
diff --git a/spec/features/work_packages/project_phases/changing_project_spec.rb b/spec/features/work_packages/project_phases/changing_project_spec.rb
index 81448598b7e..47f4f46bf1b 100644
--- a/spec/features/work_packages/project_phases/changing_project_spec.rb
+++ b/spec/features/work_packages/project_phases/changing_project_spec.rb
@@ -30,7 +30,7 @@
require "spec_helper"
-RSpec.describe "Linked projects phases and work packages when changing the project", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Linked projects phases and work packages when changing the project", :js do
include Components::Autocompleter::NgSelectAutocompleteHelpers
shared_let(:phase_definition_active_in_both_projects) { create(:project_phase_definition) }
diff --git a/spec/features/work_packages/project_phases/copying_spec.rb b/spec/features/work_packages/project_phases/copying_spec.rb
index b289edf99e0..5a4dcf3ac42 100644
--- a/spec/features/work_packages/project_phases/copying_spec.rb
+++ b/spec/features/work_packages/project_phases/copying_spec.rb
@@ -30,7 +30,7 @@
require "spec_helper"
-RSpec.describe "Copying a work package with linked project phases", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Copying a work package with linked project phases", :js do
include Components::Autocompleter::NgSelectAutocompleteHelpers
shared_let(:phase_definition) { create(:project_phase_definition) }
diff --git a/spec/features/work_packages/project_phases/linking_spec.rb b/spec/features/work_packages/project_phases/linking_spec.rb
index e9c7393bc06..61da34c126b 100644
--- a/spec/features/work_packages/project_phases/linking_spec.rb
+++ b/spec/features/work_packages/project_phases/linking_spec.rb
@@ -30,7 +30,7 @@
require "spec_helper"
-RSpec.describe "Linking projects phases and work packages", :js, with_flag: { stages_and_gates: true } do
+RSpec.describe "Linking projects phases and work packages", :js do
shared_let(:initiating_phase_definition) { create(:project_phase_definition, name: "Initiating") }
shared_let(:executing_phase_definition) do
create(:project_phase_definition, name: "Executing", start_gate: true, start_gate_name: "Ready to Execute")
diff --git a/spec/features/work_packages/table/project_phase_field_spec.rb b/spec/features/work_packages/table/project_phase_field_spec.rb
index 006e0b37487..6631fc460e1 100644
--- a/spec/features/work_packages/table/project_phase_field_spec.rb
+++ b/spec/features/work_packages/table/project_phase_field_spec.rb
@@ -128,140 +128,225 @@ RSpec.describe "Project phase field in the work package table", :js do
wait_for_network_idle
end
- context "with the feature flag being active", with_flag: { stages_and_gates: true } do
- context "with the phase being active" do
- it "shows the project phase column with the correct phase for the work package" do
- wp_table.expect_work_package_with_attributes(work_package, { projectPhase: project_phase.name })
- wp_table.expect_work_package_with_attributes(other_wp, { projectPhase: other_project_phase.name })
- wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: "-" })
+ context "with the phase being active" do
+ it "shows the project phase column with the correct phase for the work package" do
+ wp_table.expect_work_package_with_attributes(work_package, { projectPhase: project_phase.name })
+ wp_table.expect_work_package_with_attributes(other_wp, { projectPhase: other_project_phase.name })
+ wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: "-" })
+ end
+
+ describe "filtering" do
+ let(:query_filters) do
+ [{ name: "project_phase_definition_id", operator:, values: }]
end
- describe "filtering" do
- let(:query_filters) do
- [{ name: "project_phase_definition_id", operator:, values: }]
+ context "when filtering to include a phase" do
+ let(:operator) { "=" }
+ let(:values) { [phase_definition.id.to_s] }
+
+ it "only shows work packages with this phase" do
+ wp_table.expect_work_package_listed(work_package)
+ wp_table.ensure_work_package_not_listed!(other_wp, wp_without_phase)
end
+ end
- context "when filtering to include a phase" do
- let(:operator) { "=" }
- let(:values) { [phase_definition.id.to_s] }
+ context "when filtering to include multiple phases" do
+ let(:operator) { "=" }
+ let(:values) { [phase_definition.id.to_s, other_project_phase.definition.id.to_s] }
- it "only shows work packages with this phase" do
- wp_table.expect_work_package_listed(work_package)
- wp_table.ensure_work_package_not_listed!(other_wp, wp_without_phase)
- end
+ it "only shows work packages with these phases" do
+ wp_table.expect_work_package_listed(work_package, other_wp)
+ wp_table.ensure_work_package_not_listed!(wp_without_phase)
end
+ end
- context "when filtering to include multiple phases" do
- let(:operator) { "=" }
- let(:values) { [phase_definition.id.to_s, other_project_phase.definition.id.to_s] }
+ context "when filtering to exclude a phase" do
+ let(:operator) { "!" }
+ let(:values) { [other_project_phase.definition.id.to_s] }
- it "only shows work packages with these phases" do
- wp_table.expect_work_package_listed(work_package, other_wp)
- wp_table.ensure_work_package_not_listed!(wp_without_phase)
- end
+ it "shows work packages with other phases or without a phase" do
+ wp_table.expect_work_package_listed(wp_without_phase, work_package)
+ wp_table.ensure_work_package_not_listed!(other_wp)
end
+ end
- context "when filtering to exclude a phase" do
- let(:operator) { "!" }
- let(:values) { [other_project_phase.definition.id.to_s] }
+ context "when filtering to have a phase" do
+ let(:operator) { "*" }
+ let(:values) { nil }
- it "shows work packages with other phases or without a phase" do
- wp_table.expect_work_package_listed(wp_without_phase, work_package)
- wp_table.ensure_work_package_not_listed!(other_wp)
- end
+ it "shows work packages with a phase" do
+ wp_table.expect_work_package_listed(work_package, other_wp)
+ wp_table.ensure_work_package_not_listed!(wp_without_phase)
end
+ end
- context "when filtering to have a phase" do
- let(:operator) { "*" }
- let(:values) { nil }
+ context "when filtering to not have a phase" do
+ let(:operator) { "!*" }
+ let(:values) { nil }
- it "shows work packages with a phase" do
- wp_table.expect_work_package_listed(work_package, other_wp)
- wp_table.ensure_work_package_not_listed!(wp_without_phase)
- end
+ it "shows work packages without a phase" do
+ wp_table.expect_work_package_listed(wp_without_phase)
+ wp_table.ensure_work_package_not_listed!(work_package, other_wp)
end
+ end
+ end
- context "when filtering to not have a phase" do
- let(:operator) { "!*" }
- let(:values) { nil }
+ context "when sorting by project phase ASC" do
+ let(:sort_criteria) { [%w[project_phase asc]] }
- it "shows work packages without a phase" do
- wp_table.expect_work_package_listed(wp_without_phase)
- wp_table.ensure_work_package_not_listed!(work_package, other_wp)
- end
- end
+ it "sorts ASC by phase position" do
+ wp_table.expect_work_package_order(wp_without_phase, other_wp, work_package)
end
+ end
- context "when sorting by project phase ASC" do
- let(:sort_criteria) { [%w[project_phase asc]] }
+ context "when sorting by project phase DESC" do
+ let(:sort_criteria) { [%w[project_phase desc]] }
+
+ it "sorts DESC by phase position" do
+ wp_table.expect_work_package_order(work_package, other_wp, wp_without_phase)
+ end
+ end
- it "sorts ASC by phase position" do
- wp_table.expect_work_package_order(wp_without_phase, other_wp, work_package)
+ context "when editing the value of a project phase cell" do
+ it "changes the value" do
+ wp_table.update_work_package_attributes(wp_without_phase, projectPhase: phase_definition)
+ wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: project_phase.name })
+ end
+ end
+
+ context "when grouping by project phase" do
+ let(:group_by) { :project_phase }
+
+ it "groups by project phase" do
+ wp_table.expect_groups({
+ project_phase.name => 1,
+ other_project_phase.name => 1,
+ "-" => 1
+ })
+ end
+
+ it "includes the group icon in the group row header" do
+ within("#wp-table-rowgroup-1") do
+ expect(page).to have_test_selector("project-phase-icon #{other_project_phase.name}")
+ end
+
+ within("#wp-table-rowgroup-2") do
+ expect(page).to have_test_selector("project-phase-icon #{project_phase.name}")
end
end
+ end
+ end
+
+ context "with one phase being inactive" do
+ let(:project_phase) { create(:project_phase, definition: phase_definition, active: false) }
+
+ it "does not show the inactive phase" do
+ wp_table.expect_work_package_with_attributes(other_wp, { projectPhase: other_project_phase.name })
+ wp_table.expect_work_package_with_attributes(work_package, { projectPhase: "-" })
+ wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: "-" })
+ end
+
+ context "when sorting by project phase ASC" do
+ let(:sort_criteria) { [%w[project_phase asc]] }
+
+ it "sorts work packages with an inactive project phase like work packages without a project phase" do
+ wp_table.expect_work_package_order(work_package, wp_without_phase, other_wp)
+ end
+ end
- context "when sorting by project phase DESC" do
- let(:sort_criteria) { [%w[project_phase desc]] }
+ context "when grouping" do
+ let(:group_by) { :project_phase }
- it "sorts DESC by phase position" do
- wp_table.expect_work_package_order(work_package, other_wp, wp_without_phase)
+ it "groups work packages with an inactive project phase like work packages without a project phase" do
+ wp_table.expect_groups({
+ other_project_phase.name => 1,
+ "-" => 2
+ })
+ end
+ end
+
+ describe "filtering" do
+ let(:query_filters) do
+ [{ name: "project_phase_definition_id", operator:, values: }]
+ end
+ let(:values) { [phase_definition.id.to_s, other_project_phase.definition.id.to_s] }
+
+ context "when filtering to include multiple phases" do
+ let(:operator) { "=" }
+
+ it "does not consider inactive phases, even when you filter for them" do
+ wp_table.expect_work_package_listed(other_wp)
+ wp_table.ensure_work_package_not_listed!(wp_without_phase, work_package)
end
end
- context "when editing the value of a project phase cell" do
- it "changes the value" do
- wp_table.update_work_package_attributes(wp_without_phase, projectPhase: phase_definition)
- wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: project_phase.name })
+ context "when filtering to exclude phases" do
+ let(:operator) { "!" }
+
+ it "only excludes active phases, inactive phases are treated like they are not there" do
+ # `work_package` is listed since its phase is inactive. The exclusion does not apply.
+ wp_table.expect_work_package_listed(wp_without_phase, work_package)
+
+ # successfully exclude the other work package:
+ wp_table.ensure_work_package_not_listed!(other_wp)
end
end
- context "when grouping by project phase" do
- let(:group_by) { :project_phase }
+ context "when filtering to have a phase" do
+ let(:operator) { "*" }
- it "groups by project phase" do
- wp_table.expect_groups({
- project_phase.name => 1,
- other_project_phase.name => 1,
- "-" => 1
- })
+ it "considers inactive phases" do
+ wp_table.expect_work_package_listed(other_wp)
+ wp_table.ensure_work_package_not_listed!(wp_without_phase, work_package)
end
+ end
- it "includes the group icon in the group row header" do
- within("#wp-table-rowgroup-1") do
- expect(page).to have_test_selector("project-phase-icon #{other_project_phase.name}")
- end
+ context "when filtering to not have a phase" do
+ let(:operator) { "!*" }
- within("#wp-table-rowgroup-2") do
- expect(page).to have_test_selector("project-phase-icon #{project_phase.name}")
- end
+ it "considers inactive phases" do
+ wp_table.expect_work_package_listed(wp_without_phase, work_package)
+ wp_table.ensure_work_package_not_listed!(other_wp)
end
end
end
+ end
+
+ context "when viewing multiple projects" do
+ let!(:query) { build(:global_query, user: current_user) }
- context "with one phase being inactive" do
- let(:project_phase) { create(:project_phase, definition: phase_definition, active: false) }
+ context "when a phase is active in one project, but inactive in another" do
+ let(:project_phase_from_other_project) { create(:project_phase, active: false, definition: phase_definition) }
- it "does not show the inactive phase" do
+ it "shows the inactive phase as if it was not set" do
wp_table.expect_work_package_with_attributes(other_wp, { projectPhase: other_project_phase.name })
- wp_table.expect_work_package_with_attributes(work_package, { projectPhase: "-" })
- wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: "-" })
+ wp_table.expect_work_package_with_attributes(work_package, { projectPhase: phase_definition.name })
+
+ # Has no phase at all:
+ wp_table.expect_work_package_with_attributes(wp_from_another_project, { projectPhase: "" })
+ wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: "" })
+
+ # Has an inactive phase:
+ wp_table.expect_work_package_with_attributes(wp_with_phase_from_another_project, { projectPhase: "" })
end
context "when sorting by project phase ASC" do
let(:sort_criteria) { [%w[project_phase asc]] }
- it "sorts work packages with an inactive project phase like work packages without a project phase" do
- wp_table.expect_work_package_order(work_package, wp_without_phase, other_wp)
+ it "sorts work packages from projects with inactive phases like work packages without a project phase" do
+ wp_table.expect_work_package_order(wp_with_phase_from_another_project, wp_from_another_project,
+ wp_without_phase, other_wp, work_package)
end
end
context "when grouping" do
let(:group_by) { :project_phase }
- it "groups work packages with an inactive project phase like work packages without a project phase" do
+ it "groups work packages with inactive phases like work packages without a project phase" do
wp_table.expect_groups({
other_project_phase.name => 1,
- "-" => 2
+ project_phase.name => 1,
+ "-" => 3
})
end
end
@@ -270,14 +355,19 @@ RSpec.describe "Project phase field in the work package table", :js do
let(:query_filters) do
[{ name: "project_phase_definition_id", operator:, values: }]
end
- let(:values) { [phase_definition.id.to_s, other_project_phase.definition.id.to_s] }
+ # mind that project_phase_from_other_project refers to the same phase_definition, but is set to inactive
+ let(:values) { [phase_definition.id.to_s] }
context "when filtering to include multiple phases" do
let(:operator) { "=" }
it "does not consider inactive phases, even when you filter for them" do
- wp_table.expect_work_package_listed(other_wp)
- wp_table.ensure_work_package_not_listed!(wp_without_phase, work_package)
+ wp_table.expect_work_package_listed(work_package)
+
+ # has no matching phase, not listed:
+ wp_table.ensure_work_package_not_listed!(wp_without_phase, wp_from_another_project, other_wp)
+ # has the desired phase, but it's inactive, so not listed:
+ wp_table.ensure_work_package_not_listed!(wp_with_phase_from_another_project)
end
end
@@ -285,223 +375,131 @@ RSpec.describe "Project phase field in the work package table", :js do
let(:operator) { "!" }
it "only excludes active phases, inactive phases are treated like they are not there" do
- # `work_package` is listed since its phase is inactive. The exclusion does not apply.
- wp_table.expect_work_package_listed(wp_without_phase, work_package)
+ # The exclusion does not apply to the inactive phase:
+ wp_table.expect_work_package_listed(wp_with_phase_from_another_project)
+ # The exclusion does not apply if there is no phase at all:
+ wp_table.expect_work_package_listed(wp_without_phase, wp_from_another_project, other_wp)
- # successfully exclude the other work package:
- wp_table.ensure_work_package_not_listed!(other_wp)
+ # This phase is active and thus excluded:
+ wp_table.ensure_work_package_not_listed!(work_package)
end
end
context "when filtering to have a phase" do
let(:operator) { "*" }
- it "considers inactive phases" do
- wp_table.expect_work_package_listed(other_wp)
- wp_table.ensure_work_package_not_listed!(wp_without_phase, work_package)
+ it "treats inactive phases like they are not there" do
+ wp_table.expect_work_package_listed(work_package, other_wp)
+ wp_table.ensure_work_package_not_listed!(
+ wp_without_phase, wp_from_another_project, wp_with_phase_from_another_project
+ )
end
end
context "when filtering to not have a phase" do
let(:operator) { "!*" }
- it "considers inactive phases" do
- wp_table.expect_work_package_listed(wp_without_phase, work_package)
- wp_table.ensure_work_package_not_listed!(other_wp)
+ it "treats inactive phases like they are not there" do
+ wp_table.expect_work_package_listed(
+ wp_without_phase, wp_from_another_project, wp_with_phase_from_another_project
+ )
+ wp_table.ensure_work_package_not_listed!(work_package, other_wp)
end
end
end
end
+ end
- context "when viewing multiple projects" do
- let!(:query) { build(:global_query, user: current_user) }
-
- context "when a phase is active in one project, but inactive in another" do
- let(:project_phase_from_other_project) { create(:project_phase, active: false, definition: phase_definition) }
-
- it "shows the inactive phase as if it was not set" do
- wp_table.expect_work_package_with_attributes(other_wp, { projectPhase: other_project_phase.name })
- wp_table.expect_work_package_with_attributes(work_package, { projectPhase: phase_definition.name })
-
- # Has no phase at all:
- wp_table.expect_work_package_with_attributes(wp_from_another_project, { projectPhase: "" })
- wp_table.expect_work_package_with_attributes(wp_without_phase, { projectPhase: "" })
-
- # Has an inactive phase:
- wp_table.expect_work_package_with_attributes(wp_with_phase_from_another_project, { projectPhase: "" })
- end
-
- context "when sorting by project phase ASC" do
- let(:sort_criteria) { [%w[project_phase asc]] }
-
- it "sorts work packages from projects with inactive phases like work packages without a project phase" do
- wp_table.expect_work_package_order(wp_with_phase_from_another_project, wp_from_another_project,
- wp_without_phase, other_wp, work_package)
- end
- end
-
- context "when grouping" do
- let(:group_by) { :project_phase }
-
- it "groups work packages with inactive phases like work packages without a project phase" do
- wp_table.expect_groups({
- other_project_phase.name => 1,
- project_phase.name => 1,
- "-" => 3
- })
- end
- end
-
- describe "filtering" do
- let(:query_filters) do
- [{ name: "project_phase_definition_id", operator:, values: }]
- end
- # mind that project_phase_from_other_project refers to the same phase_definition, but is set to inactive
- let(:values) { [phase_definition.id.to_s] }
-
- context "when filtering to include multiple phases" do
- let(:operator) { "=" }
-
- it "does not consider inactive phases, even when you filter for them" do
- wp_table.expect_work_package_listed(work_package)
-
- # has no matching phase, not listed:
- wp_table.ensure_work_package_not_listed!(wp_without_phase, wp_from_another_project, other_wp)
- # has the desired phase, but it's inactive, so not listed:
- wp_table.ensure_work_package_not_listed!(wp_with_phase_from_another_project)
- end
- end
-
- context "when filtering to exclude phases" do
- let(:operator) { "!" }
-
- it "only excludes active phases, inactive phases are treated like they are not there" do
- # The exclusion does not apply to the inactive phase:
- wp_table.expect_work_package_listed(wp_with_phase_from_another_project)
- # The exclusion does not apply if there is no phase at all:
- wp_table.expect_work_package_listed(wp_without_phase, wp_from_another_project, other_wp)
-
- # This phase is active and thus excluded:
- wp_table.ensure_work_package_not_listed!(work_package)
- end
- end
+ context "without the necessary permissions to view phases in some projects" do
+ let!(:query) { build(:global_query, user: current_user) }
+ let(:another_project_permissions) do
+ all_permissions - [:view_project_phases]
+ end
- context "when filtering to have a phase" do
- let(:operator) { "*" }
+ it "does not render project phases you don't have permission for" do
+ # permission given, phase visible:
+ wp_table.expect_work_package_with_attributes(work_package, { projectPhase: phase_definition.name })
- it "treats inactive phases like they are not there" do
- wp_table.expect_work_package_listed(work_package, other_wp)
- wp_table.ensure_work_package_not_listed!(
- wp_without_phase, wp_from_another_project, wp_with_phase_from_another_project
- )
- end
- end
+ # permission missing, phase invisible:
+ wp_table.expect_work_package_with_attributes(wp_from_another_project, { projectPhase: "" })
+ wp_table.expect_work_package_with_attributes(wp_with_phase_from_another_project, { projectPhase: "" })
+ end
- context "when filtering to not have a phase" do
- let(:operator) { "!*" }
+ context "when sorting by project phase ASC" do
+ let(:sort_criteria) { [%w[project_phase asc]] }
- it "treats inactive phases like they are not there" do
- wp_table.expect_work_package_listed(
- wp_without_phase, wp_from_another_project, wp_with_phase_from_another_project
- )
- wp_table.ensure_work_package_not_listed!(work_package, other_wp)
- end
- end
- end
+ it "sorts work packages from projects you don't have permission to like work packages without a project phase" do
+ wp_table.expect_work_package_order(wp_with_phase_from_another_project, wp_from_another_project,
+ wp_without_phase, other_wp, work_package)
end
end
- context "without the necessary permissions to view phases in some projects" do
- let!(:query) { build(:global_query, user: current_user) }
- let(:another_project_permissions) do
- all_permissions - [:view_project_phases]
- end
+ context "when grouping" do
+ let(:group_by) { :project_phase }
- it "does not render project phases you don't have permission for" do
- # permission given, phase visible:
- wp_table.expect_work_package_with_attributes(work_package, { projectPhase: phase_definition.name })
-
- # permission missing, phase invisible:
- wp_table.expect_work_package_with_attributes(wp_from_another_project, { projectPhase: "" })
- wp_table.expect_work_package_with_attributes(wp_with_phase_from_another_project, { projectPhase: "" })
+ it "groups work packages from projects you don't have permission to like work packages without a project phase" do
+ wp_table.expect_groups({
+ other_project_phase.name => 1,
+ project_phase.name => 1,
+ "-" => 3
+ })
end
+ end
- context "when sorting by project phase ASC" do
- let(:sort_criteria) { [%w[project_phase asc]] }
-
- it "sorts work packages from projects you don't have permission to like work packages without a project phase" do
- wp_table.expect_work_package_order(wp_with_phase_from_another_project, wp_from_another_project,
- wp_without_phase, other_wp, work_package)
- end
+ describe "filtering" do
+ let(:query_filters) do
+ [{ name: "project_phase_definition_id", operator:, values: }]
end
+ let(:values) { [phase_definition.id.to_s, other_project_phase.definition.id.to_s] }
+ let(:operator) { "=" }
- context "when grouping" do
- let(:group_by) { :project_phase }
-
- it "groups work packages from projects you don't have permission to like work packages without a project phase" do
- wp_table.expect_groups({
- other_project_phase.name => 1,
- project_phase.name => 1,
- "-" => 3
- })
- end
+ it "offers a phase filter" do
+ expect(query.available_filters.map(&:name)).to include(:project_phase_definition_id)
end
- describe "filtering" do
- let(:query_filters) do
- [{ name: "project_phase_definition_id", operator:, values: }]
- end
- let(:values) { [phase_definition.id.to_s, other_project_phase.definition.id.to_s] }
+ context "when filtering to include multiple phases" do
let(:operator) { "=" }
- it "offers a phase filter" do
- expect(query.available_filters.map(&:name)).to include(:project_phase_definition_id)
- end
+ it "does not consider unviewable phases, even when you filter for them" do
+ wp_table.expect_work_package_listed(other_wp, work_package)
- context "when filtering to include multiple phases" do
- let(:operator) { "=" }
-
- it "does not consider unviewable phases, even when you filter for them" do
- wp_table.expect_work_package_listed(other_wp, work_package)
-
- wp_table.ensure_work_package_not_listed!(wp_with_phase_from_another_project, wp_without_phase)
- end
+ wp_table.ensure_work_package_not_listed!(wp_with_phase_from_another_project, wp_without_phase)
end
+ end
- context "when filtering to exclude phases" do
- let(:operator) { "!" }
+ context "when filtering to exclude phases" do
+ let(:operator) { "!" }
- it "only excludes active phases, inactive phases are treated like they are not there" do
- wp_table.expect_work_package_listed(
- wp_without_phase, wp_with_phase_from_another_project, wp_from_another_project
- )
+ it "only excludes active phases, inactive phases are treated like they are not there" do
+ wp_table.expect_work_package_listed(
+ wp_without_phase, wp_with_phase_from_another_project, wp_from_another_project
+ )
- wp_table.ensure_work_package_not_listed!(other_wp, work_package)
- end
+ wp_table.ensure_work_package_not_listed!(other_wp, work_package)
end
+ end
- context "when filtering to have a phase" do
- let(:operator) { "*" }
+ context "when filtering to have a phase" do
+ let(:operator) { "*" }
- it "treats unviewable phases like they are not there" do
- wp_table.expect_work_package_listed(other_wp, work_package)
+ it "treats unviewable phases like they are not there" do
+ wp_table.expect_work_package_listed(other_wp, work_package)
- wp_table.ensure_work_package_not_listed!(
- wp_without_phase, wp_with_phase_from_another_project, wp_from_another_project
- )
- end
+ wp_table.ensure_work_package_not_listed!(
+ wp_without_phase, wp_with_phase_from_another_project, wp_from_another_project
+ )
end
+ end
- context "when filtering to not have a phase" do
- let(:operator) { "!*" }
+ context "when filtering to not have a phase" do
+ let(:operator) { "!*" }
- it "treats unviewable phases like they are not there" do
- wp_table.expect_work_package_listed(
- wp_without_phase, wp_with_phase_from_another_project, wp_from_another_project
- )
+ it "treats unviewable phases like they are not there" do
+ wp_table.expect_work_package_listed(
+ wp_without_phase, wp_with_phase_from_another_project, wp_from_another_project
+ )
- wp_table.ensure_work_package_not_listed!(other_wp, work_package)
- end
+ wp_table.ensure_work_package_not_listed!(other_wp, work_package)
end
end
end
@@ -521,13 +519,4 @@ RSpec.describe "Project phase field in the work package table", :js do
end
end
end
-
- context "with the feature flag being inactive", with_flag: { stages_and_gates: false } do
- let(:query_columns) { %w(subject) }
-
- it "does not offer to add the column to a query" do
- wp_table.click_setting_item("Insert column")
- wp_table.expect_no_column_add_option("Project phase")
- end
- end
end
diff --git a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb
index 837138d1cdf..546efcf1078 100644
--- a/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb
+++ b/spec/lib/api/v3/work_packages/schema/work_package_schema_representer_spec.rb
@@ -830,45 +830,35 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSchemaRepresenter do
end
describe "projectPhase" do
- context "with the feature enabled", with_flag: { stages_and_gates: true } do
- context "with the view_project_phases permission" do
- let(:permissions) { %i[edit_work_packages view_project_phases] }
-
- it_behaves_like "has basic schema properties" do
- let(:path) { "projectPhase" }
- let(:type) { "ProjectPhase" }
- let(:name) { I18n.t("attributes.project_phase") }
- let(:required) { false }
- let(:writable) { true }
- let(:location) { "_links" }
- end
-
- it_behaves_like "has a collection of allowed values" do
- let(:json_path) { "projectPhase" }
- let(:href_path) { "project_phases" }
- let(:factory) { :project_phase }
- end
- end
-
- context "without any phases active in the project" do
- let(:permissions) { %i[edit_work_packages view_project_phases] }
- let(:assignable_project_phases) { [] }
+ context "with the view_project_phases permission" do
+ let(:permissions) { %i[edit_work_packages view_project_phases] }
- it "has no projectPhase attribute" do
- expect(subject).not_to have_json_path("projectPhase")
- end
+ it_behaves_like "has basic schema properties" do
+ let(:path) { "projectPhase" }
+ let(:type) { "ProjectPhase" }
+ let(:name) { I18n.t("attributes.project_phase") }
+ let(:required) { false }
+ let(:writable) { true }
+ let(:location) { "_links" }
end
- context "without the view_project_phases permission" do
- it "has no projectPhase attribute" do
- expect(subject).not_to have_json_path("projectPhase")
- end
+ it_behaves_like "has a collection of allowed values" do
+ let(:json_path) { "projectPhase" }
+ let(:href_path) { "project_phases" }
+ let(:factory) { :project_phase }
end
end
- context "with the feature disabled" do
+ context "without any phases active in the project" do
let(:permissions) { %i[edit_work_packages view_project_phases] }
+ let(:assignable_project_phases) { [] }
+
+ it "has no projectPhase attribute" do
+ expect(subject).not_to have_json_path("projectPhase")
+ end
+ end
+ context "without the view_project_phases permission" do
it "has no projectPhase attribute" do
expect(subject).not_to have_json_path("projectPhase")
end
diff --git a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
index 25ae494f7ba..f5c282e0827 100644
--- a/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
+++ b/spec/lib/api/v3/work_packages/work_package_representer_spec.rb
@@ -677,69 +677,61 @@ RSpec.describe API::V3::WorkPackages::WorkPackageRepresenter do
end
describe "projectPhase" do
- context "with the feature flag being active", with_flag: { stages_and_gates: true } do
- context "with a phase being set" do
- it_behaves_like "has a titled link" do
- let(:link) { "projectPhase" }
- let(:href) { api_v3_paths.project_phase(project_phase.id) }
- let(:title) { project_phase.name }
- end
+ context "with a phase being set" do
+ it_behaves_like "has a titled link" do
+ let(:link) { "projectPhase" }
+ let(:href) { api_v3_paths.project_phase(project_phase.id) }
+ let(:title) { project_phase.name }
end
+ end
- context "without a phase being set" do
- before do
- work_package.project_phase_definition = nil
- end
-
- it_behaves_like "has an empty link" do
- let(:link) { "projectPhase" }
- end
+ context "without a phase being set" do
+ before do
+ work_package.project_phase_definition = nil
end
- context "with the phase not existing in the project" do
- let(:project_phase) { nil }
-
- it_behaves_like "has an empty link" do
- let(:link) { "projectPhase" }
- end
+ it_behaves_like "has an empty link" do
+ let(:link) { "projectPhase" }
end
+ end
- context "with the phase being inactive in the project" do
- let(:project_phase) { build_stubbed(:project_phase, active: false, definition: project_phase_definition) }
+ context "with the phase not existing in the project" do
+ let(:project_phase) { nil }
- it_behaves_like "has an empty link" do
- let(:link) { "projectPhase" }
- end
+ it_behaves_like "has an empty link" do
+ let(:link) { "projectPhase" }
end
+ end
- context "without the user being allowed to see the reference" do
- let(:permissions) { all_permissions - [:view_project_phases] }
+ context "with the phase being inactive in the project" do
+ let(:project_phase) { build_stubbed(:project_phase, active: false, definition: project_phase_definition) }
- it_behaves_like "has no link" do
- let(:link) { "projectPhase" }
- end
+ it_behaves_like "has an empty link" do
+ let(:link) { "projectPhase" }
end
+ end
- context "without any phase existing in the project" do
- let(:project_phases) { [] }
+ context "without the user being allowed to see the reference" do
+ let(:permissions) { all_permissions - [:view_project_phases] }
- it_behaves_like "has no link" do
- let(:link) { "projectPhase" }
- end
+ it_behaves_like "has no link" do
+ let(:link) { "projectPhase" }
end
+ end
- context "without any phase active in the project" do
- before do
- project_phases.each { |phase| phase.active = false }
- end
+ context "without any phase existing in the project" do
+ let(:project_phases) { [] }
- it_behaves_like "has no link" do
- let(:link) { "projectPhase" }
- end
+ it_behaves_like "has no link" do
+ let(:link) { "projectPhase" }
end
end
- context "without the feature flag being active" do
+ context "without any phase active in the project" do
+ before do
+ project_phases.each { |phase| phase.active = false }
+ end
+
it_behaves_like "has no link" do
let(:link) { "projectPhase" }
end
@@ -1395,93 +1387,85 @@ RSpec.describe API::V3::WorkPackages::WorkPackageRepresenter do
let(:embedded_resource) { project_phase_definition }
let(:embedded_resource_type) { "ProjectPhase" }
- context "with the feature flag being active", with_flag: { stages_and_gates: true } do
- context "with a phase being set" do
- it_behaves_like "has the resource embedded"
- end
-
- context "without a phase being set" do
- before do
- work_package.project_phase_definition = nil
- end
+ context "with a phase being set" do
+ it_behaves_like "has the resource embedded"
+ end
- it_behaves_like "has the resource not embedded"
+ context "without a phase being set" do
+ before do
+ work_package.project_phase_definition = nil
end
- context "with the phase not existing in the project" do
- let(:project_phases) { [other_project_phase] }
-
- it_behaves_like "has the resource not embedded"
- end
+ it_behaves_like "has the resource not embedded"
+ end
- context "with the phase being inactive in the project" do
- let(:project_phase) { build_stubbed(:project_phase, active: false, definition: project_phase_definition) }
+ context "with the phase not existing in the project" do
+ let(:project_phases) { [other_project_phase] }
- it_behaves_like "has the resource not embedded"
- end
+ it_behaves_like "has the resource not embedded"
+ end
- context "without the user being allowed to see the reference" do
- let(:permissions) { all_permissions - [:view_project_phases] }
+ context "with the phase being inactive in the project" do
+ let(:project_phase) { build_stubbed(:project_phase, active: false, definition: project_phase_definition) }
- it_behaves_like "has the resource not embedded"
- end
+ it_behaves_like "has the resource not embedded"
end
- context "with the feature flag being inactive" do
+ context "without the user being allowed to see the reference" do
+ let(:permissions) { all_permissions - [:view_project_phases] }
+
it_behaves_like "has the resource not embedded"
end
end
describe "projectPhaseDefinition" do
- context "with the feature flag being active", with_flag: { stages_and_gates: true } do
- context "with a phase being set" do
- it_behaves_like "has a titled link" do
- let(:link) { "projectPhaseDefinition" }
- let(:href) { "/api/v3/project_phase_definitions/#{work_package.project_phase_definition_id}" }
- let(:title) { work_package.project_phase_definition.name }
- end
+ context "with a phase being set" do
+ it_behaves_like "has a titled link" do
+ let(:link) { "projectPhaseDefinition" }
+ let(:href) { "/api/v3/project_phase_definitions/#{work_package.project_phase_definition_id}" }
+ let(:title) { work_package.project_phase_definition.name }
end
+ end
- context "without a phase being set" do
- before do
- work_package.project_phase_definition = nil
- end
+ context "without a phase being set" do
+ before do
+ work_package.project_phase_definition = nil
+ end
- it_behaves_like "has a titled link" do
- let(:link) { "projectPhaseDefinition" }
- let(:href) { nil }
- let(:title) { nil }
- end
+ it_behaves_like "has a titled link" do
+ let(:link) { "projectPhaseDefinition" }
+ let(:href) { nil }
+ let(:title) { nil }
end
+ end
- context "with the phase not existing in the project" do
- let(:project_phases) { [other_project_phase] }
+ context "with the phase not existing in the project" do
+ let(:project_phases) { [other_project_phase] }
- it_behaves_like "has a titled link" do
- let(:link) { "projectPhaseDefinition" }
- let(:href) { nil }
- let(:title) { nil }
- end
+ it_behaves_like "has a titled link" do
+ let(:link) { "projectPhaseDefinition" }
+ let(:href) { nil }
+ let(:title) { nil }
end
+ end
- context "with the phase being inactive in the project" do
- let(:project_phase) { build_stubbed(:project_phase, active: false, definition: project_phase_definition) }
+ context "with the phase being inactive in the project" do
+ let(:project_phase) { build_stubbed(:project_phase, active: false, definition: project_phase_definition) }
- it_behaves_like "has a titled link" do
- let(:link) { "projectPhaseDefinition" }
- let(:href) { nil }
- let(:title) { nil }
- end
+ it_behaves_like "has a titled link" do
+ let(:link) { "projectPhaseDefinition" }
+ let(:href) { nil }
+ let(:title) { nil }
end
+ end
- context "without the user being allowed to see the reference" do
- let(:permissions) { all_permissions - [:view_project_phases] }
+ context "without the user being allowed to see the reference" do
+ let(:permissions) { all_permissions - [:view_project_phases] }
- it_behaves_like "has a titled link" do
- let(:link) { "projectPhaseDefinition" }
- let(:href) { nil }
- let(:title) { nil }
- end
+ it_behaves_like "has a titled link" do
+ let(:link) { "projectPhaseDefinition" }
+ let(:href) { nil }
+ let(:title) { nil }
end
end
end
diff --git a/spec/models/queries/projects/filters/project_phase_any_filter_spec.rb b/spec/models/queries/projects/filters/project_phase_any_filter_spec.rb
index 67ae71503bc..8c55cdcec99 100644
--- a/spec/models/queries/projects/filters/project_phase_any_filter_spec.rb
+++ b/spec/models/queries/projects/filters/project_phase_any_filter_spec.rb
@@ -56,7 +56,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseAnyFilter do
end
end
- context "for a user with the necessary permission and the feature flag on", with_flag: { stages_and_gates: true } do
+ context "for a user with the necessary permission" do
let(:permissions) { %i[view_project_phases] }
it "is true" do
@@ -65,16 +65,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseAnyFilter do
end
end
- context "for a user with the necessary permission and the feature flag off", with_flag: { stages_and_gates: false } do
- let(:permissions) { %i[view_project_phases] }
-
- it "is false" do
- expect(instance)
- .not_to be_available
- end
- end
-
- context "for a user without the necessary permission", with_flag: { stages_and_gates: true } do
+ context "for a user without the necessary permission" do
let(:permissions) { %i[view_project] }
it "is false" do
diff --git a/spec/models/queries/projects/filters/project_phase_filter_spec.rb b/spec/models/queries/projects/filters/project_phase_filter_spec.rb
index 84f6a4a6dc7..54543c688eb 100644
--- a/spec/models/queries/projects/filters/project_phase_filter_spec.rb
+++ b/spec/models/queries/projects/filters/project_phase_filter_spec.rb
@@ -103,7 +103,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseFilter do
end
end
- context "for a user with the necessary permission and the feature flag on", with_flag: { stages_and_gates: true } do
+ context "for a user with the necessary permission" do
let(:permissions) { %i[view_project_phases] }
it "is true" do
@@ -112,16 +112,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseFilter do
end
end
- context "for a user with the necessary permission and the feature flag off", with_flag: { stages_and_gates: false } do
- let(:permissions) { %i[view_project_phases] }
-
- it "is false" do
- expect(instance)
- .not_to be_available
- end
- end
-
- context "for a user without the necessary permission", with_flag: { stages_and_gates: true } do
+ context "for a user without the necessary permission" do
let(:permissions) { %i[view_project] }
it "is false" do
diff --git a/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb b/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb
index 152f1d99897..7a4b6a6368f 100644
--- a/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb
+++ b/spec/models/queries/projects/filters/project_phase_gate_filter_spec.rb
@@ -161,7 +161,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
end
end
- context "for a user with the necessary permission and the feature flag on", with_flag: { stages_and_gates: true } do
+ context "for a user with the necessary permission" do
let(:permissions) { %i[view_project_phases] }
it "is true" do
@@ -170,16 +170,7 @@ RSpec.describe Queries::Projects::Filters::ProjectPhaseGateFilter do
end
end
- context "for a user with the necessary permission and the feature flag off", with_flag: { stages_and_gates: false } do
- let(:permissions) { %i[view_project_phases] }
-
- it "is false" do
- expect(instance)
- .not_to be_available
- end
- end
-
- context "for a user without the necessary permission", with_flag: { stages_and_gates: true } do
+ context "for a user without the necessary permission" do
let(:permissions) { %i[view_project] }
it "is false" do
diff --git a/spec/models/queries/projects/orders/project_phase_order_spec.rb b/spec/models/queries/projects/orders/project_phase_order_spec.rb
index 13080134dfd..0ecf4b380d8 100644
--- a/spec/models/queries/projects/orders/project_phase_order_spec.rb
+++ b/spec/models/queries/projects/orders/project_phase_order_spec.rb
@@ -50,6 +50,8 @@ RSpec.describe Queries::Projects::Orders::ProjectPhaseOrder do
end
describe "#available?" do
+ let!(:project_phase_def) { create(:project_phase_definition) }
+
let(:instance) { described_class.new("project_phase_#{project_phase_def.id}") }
let(:permissions) { %i(view_project_phases) }
@@ -62,28 +64,15 @@ RSpec.describe Queries::Projects::Orders::ProjectPhaseOrder do
current_user { user }
- context "without feature flag set" do
- let!(:project_phase_def) { create(:project_phase_definition) }
-
- it "does not allow to sort by it" do
- expect(instance).not_to be_available
- end
+ it "allows to sort by it" do
+ expect(instance).to be_available
end
- context "with feature flag set", with_flag: { stages_and_gates: true } do
- let!(:project_phase_def) { create(:project_phase_definition) }
+ context "without permission in any project" do
+ let(:permissions) { [] }
- it "allows to sort by it" do
- expect(instance).to be_available
- end
-
- context "without permission in any project" do
- let!(:project_phase_def) { create(:project_phase_definition) }
- let(:permissions) { [] }
-
- it "is not available" do
- expect(instance).not_to be_available
- end
+ it "is not available" do
+ expect(instance).not_to be_available
end
end
end
diff --git a/spec/models/queries/work_packages/filter/project_phase_filter_spec.rb b/spec/models/queries/work_packages/filter/project_phase_filter_spec.rb
index 2e8978d7148..4b8f0711b2e 100644
--- a/spec/models/queries/work_packages/filter/project_phase_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/project_phase_filter_spec.rb
@@ -36,141 +36,99 @@ RSpec.describe Queries::WorkPackages::Filter::ProjectPhaseFilter do
let(:class_key) { :project_phase_definition_id }
current_user { build_stubbed(:user) }
- context "with feature flag being active", with_flag: { stages_and_gates: true } do
- context "with the permission to view project phases" do
- before do
- mock_permissions_for(current_user, &:allow_everything)
- login_as(current_user)
- end
-
- describe "#available?" do
- context "with existing phases" do
- before do
- create(:project_phase_definition)
- end
+ context "with the permission to view project phases" do
+ before do
+ mock_permissions_for(current_user, &:allow_everything)
+ login_as(current_user)
+ end
- it "is true" do
- expect(instance).to be_available
- end
+ describe "#available?" do
+ context "with existing phases" do
+ before do
+ create(:project_phase_definition)
end
- context "without existing phases" do
- it "is false" do
- expect(instance).not_to be_available
- end
+ it "is true" do
+ expect(instance).to be_available
end
end
- describe "#allowed_values" do
- context "with existing phases" do
- let!(:definition) { create(:project_phase_definition) }
- let!(:other_definition) { create(:project_phase_definition) }
- let!(:first_definition) { create(:project_phase_definition, position: 0) }
-
- it "returns an array of phase definition options, ordered by position" do
- expect(instance.allowed_values)
- .to contain_exactly([first_definition.name, first_definition.id.to_s],
- [definition.name, definition.id.to_s],
- [other_definition.name, other_definition.id.to_s])
- end
- end
-
- context "without existing phases" do
- it "returns an empty array" do
- expect(instance.allowed_values)
- .to be_empty
- end
+ context "without existing phases" do
+ it "is false" do
+ expect(instance).not_to be_available
end
end
+ end
- describe "#value_objects" do
- let(:definition1) { create(:project_phase_definition) }
- let(:definition2) { create(:project_phase_definition) }
+ describe "#allowed_values" do
+ context "with existing phases" do
+ let!(:definition) { create(:project_phase_definition) }
+ let!(:other_definition) { create(:project_phase_definition) }
+ let!(:first_definition) { create(:project_phase_definition, position: 0) }
- before do
- instance.values = [definition1.id.to_s, definition2.id.to_s]
+ it "returns an array of phase definition options, ordered by position" do
+ expect(instance.allowed_values)
+ .to contain_exactly([first_definition.name, first_definition.id.to_s],
+ [definition.name, definition.id.to_s],
+ [other_definition.name, other_definition.id.to_s])
end
+ end
- it "returns an array of types" do
- expect(instance.value_objects)
- .to contain_exactly(definition1, definition2)
+ context "without existing phases" do
+ it "returns an empty array" do
+ expect(instance.allowed_values)
+ .to be_empty
end
end
end
- context "without the permission to view project phases" do
- describe "#available?" do
- context "with existing phases" do
- before do
- create(:project_phase_definition)
- end
-
- it "is false" do
- expect(instance).not_to be_available
- end
- end
+ describe "#value_objects" do
+ let(:definition1) { create(:project_phase_definition) }
+ let(:definition2) { create(:project_phase_definition) }
- context "without existing phases" do
- it "is false" do
- expect(instance).not_to be_available
- end
- end
+ before do
+ instance.values = [definition1.id.to_s, definition2.id.to_s]
end
- describe "#allowed_values" do
- context "with existing phases" do
- let!(:definition) { create(:project_phase_definition) }
- let!(:other_definition) { create(:project_phase_definition) }
- let!(:first_definition) { create(:project_phase_definition, position: 0) }
-
- it "returns an empty array" do
- expect(instance.allowed_values)
- .to be_empty
- end
- end
-
- context "without existing phases" do
- it "returns an empty array" do
- expect(instance.allowed_values)
- .to be_empty
- end
- end
+ it "returns an array of types" do
+ expect(instance.value_objects)
+ .to contain_exactly(definition1, definition2)
end
end
end
- context "with feature flag being inactive" do
- context "with existing phases" do
- let!(:definition) { create(:project_phase_definition) }
- let!(:other_definition) { create(:project_phase_definition) }
- let!(:first_definition) { create(:project_phase_definition, position: 0) }
+ context "without the permission to view project phases" do
+ describe "#available?" do
+ context "with existing phases" do
+ before do
+ create(:project_phase_definition)
+ end
- before do
- create(:project_phase_definition)
+ it "is false" do
+ expect(instance).not_to be_available
+ end
end
- describe "#available?" do
+ context "without existing phases" do
it "is false" do
expect(instance).not_to be_available
end
end
+ end
+
+ describe "#allowed_values" do
+ context "with existing phases" do
+ let!(:definition) { create(:project_phase_definition) }
+ let!(:other_definition) { create(:project_phase_definition) }
+ let!(:first_definition) { create(:project_phase_definition, position: 0) }
- describe "#allowed_values" do
it "returns an empty array" do
expect(instance.allowed_values)
.to be_empty
end
end
- end
-
- context "without existing phases" do
- describe "#available?" do
- it "is false" do
- expect(instance).not_to be_available
- end
- end
- describe "#allowed_values" do
+ context "without existing phases" do
it "returns an empty array" do
expect(instance.allowed_values)
.to be_empty
diff --git a/spec/services/projects/copy_service_integration_spec.rb b/spec/services/projects/copy_service_integration_spec.rb
index 1b56a304ab4..f4853432307 100644
--- a/spec/services/projects/copy_service_integration_spec.rb
+++ b/spec/services/projects/copy_service_integration_spec.rb
@@ -95,53 +95,27 @@ RSpec.describe(
end
describe ".copyable_dependencies" do
- context "with project phases inactive", with_flag: { stages_and_gates: false } do
- it "includes the list of dependencies" do
- expect(described_class.copyable_dependencies.pluck(:identifier)).to eq(
- %w(
- members
- versions
- categories
- work_packages
- work_package_attachments
- work_package_shares
- wiki
- wiki_page_attachments
- forums
- queries
- boards
- overview
- storages
- storage_project_folders
- file_links
- )
+ it "includes the list of dependencies" do
+ expect(described_class.copyable_dependencies.pluck(:identifier)).to eq(
+ %w(
+ members
+ versions
+ categories
+ work_packages
+ work_package_attachments
+ work_package_shares
+ wiki
+ wiki_page_attachments
+ forums
+ queries
+ boards
+ overview
+ phases
+ storages
+ storage_project_folders
+ file_links
)
- end
- end
-
- context "with project phases active", with_flag: { stages_and_gates: true } do
- it "includes the list of dependencies" do
- expect(described_class.copyable_dependencies.pluck(:identifier)).to eq(
- %w(
- members
- versions
- categories
- work_packages
- work_package_attachments
- work_package_shares
- wiki
- wiki_page_attachments
- forums
- queries
- boards
- overview
- phases
- storages
- storage_project_folders
- file_links
- )
- )
- end
+ )
end
end
@@ -283,7 +257,7 @@ RSpec.describe(
# rubocop:disable RSpec/ExampleLength
# rubocop:disable RSpec/MultipleExpectations
- it "copies all dependencies and set attributes", with_flag: { stages_and_gates: true } do
+ it "copies all dependencies and set attributes" do
expect(subject).to be_success
expect(project_copy.members.count).to eq 1
@@ -914,7 +888,7 @@ RSpec.describe(
end
end
- context "with project phases associated", with_flag: { stages_and_gates: true } do
+ context "with project phases associated" do
before do
source_wp.update_column(:project_phase_definition_id, source_project_phase.definition_id)
end
@@ -974,7 +948,7 @@ RSpec.describe(
end
end
- context "with project phases", with_flag: { stages_and_gates: true } do
+ context "with project phases" do
let(:only_args) { %i[phases] }
let!(:inactive_source_project_phase) do
diff --git a/spec/services/work_packages/copy_service_integration_spec.rb b/spec/services/work_packages/copy_service_integration_spec.rb
index 8cec5ea620e..4e1c1bcd393 100644
--- a/spec/services/work_packages/copy_service_integration_spec.rb
+++ b/spec/services/work_packages/copy_service_integration_spec.rb
@@ -107,7 +107,7 @@ RSpec.describe WorkPackages::CopyService, "integration", type: :model do
end
end
- describe "#project_phase_definition", with_flag: { stages_and_gates: true } do
+ describe "#project_phase_definition" do
it "is the one of the copied work package" do
expect(copy.project_phase_definition)
.to eql project_phase_definition
@@ -204,7 +204,7 @@ RSpec.describe WorkPackages::CopyService, "integration", type: :model do
end
end
- describe "#project_phase_definition", with_flag: { stages_and_gates: true } do
+ describe "#project_phase_definition" do
it "is the one of the copied work package" do
expect(copy.project_phase_definition)
.to eql project_phase_definition