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

Adapt spec

Oliver Günther55e5922433b7
diff --git a/spec/features/work_packages/tabs/relations_children_spec.rb b/spec/features/work_packages/tabs/relations_children_spec.rb
index e2b3ea74398..59e43a90f66 100644
--- a/spec/features/work_packages/tabs/relations_children_spec.rb
+++ b/spec/features/work_packages/tabs/relations_children_spec.rb
@@ -62,14 +62,32 @@ RSpec.describe "Relations children tab", :js, :with_cuprite do
end
end
- context "when work package is a milestone" do
- let(:work_package) { create(:work_package, type: type_milestone, project:, subject: "Parent") }
+ context "when work package is a milestone and user does not have manage_work_package_relations permission" do
+ let(:work_package) { create(:work_package, type: type_milestone, project:, subject: "Milestone") }
it "does not show the action" do
wp_page.visit_tab!("relations")
relations_tab.expect_no_add_relation_button
end
end
+
+ context "when work package is a milestone and user has manage_work_package_relations permission" do
+ let!(:user) do
+ create(:user,
+ member_with_permissions: {
+ project => %i[view_work_packages manage_subtasks manage_work_package_relations]
+ })
+ end
+ let(:work_package) { create(:work_package, type: type_milestone, project:, subject: "Milestone") }
+
+ it "shows the menu, but not the child actions" do
+ wp_page.visit_tab!("relations")
+ relations_tab.expect_add_relation_button
+ relations_tab.expect_new_relation_type("Related to")
+ relations_tab.expect_no_new_relation_type("Existing child")
+ relations_tab.expect_no_new_relation_type("New child")
+ end
+ end
end
context "without permissions to add children" do
@@ -88,7 +106,7 @@ RSpec.describe "Relations children tab", :js, :with_cuprite do
create(:user, member_with_permissions: { project => %i[view_work_packages manage_subtasks] })
end
- it "does not show the action" do
+ it "shows an action to add 'Existing child', but not to add 'New child'" do
wp_page.visit_tab!("relations")
relations_tab.expect_add_relation_button
relations_tab.expect_new_relation_type("Existing child")