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

Add failing test case for Bug #62587

Christophe Bliard845f188b151e
diff --git a/spec/models/relations/scopes/visible_spec.rb b/spec/models/relations/scopes/visible_spec.rb
index 1db0c7978dc..d91770cc2f9 100644
--- a/spec/models/relations/scopes/visible_spec.rb
+++ b/spec/models/relations/scopes/visible_spec.rb
@@ -87,5 +87,28 @@ RSpec.describe Relations::Scopes::Visible do
.to be_empty
end
end
+
+ context "when multiple relations exists between 3 work packages" do
+ # In this setup, each work package has a related_to relation to the 2 other work packages
+ let_work_packages(<<~TABLE)
+ subject | related to
+ red | green
+ green | blue
+ blue | red
+ TABLE
+
+ it "returns only the relations directly related to the work package (Bug #62587)" do
+ expect(red.relations.visible).to be_empty
+ expect(green.relations.visible).to be_empty
+ expect(blue.relations.visible).to be_empty
+
+ admin = create(:admin)
+ User.execute_as(admin) do
+ expect(red.relations.visible).to contain_exactly(red.relations)
+ expect(green.relations.visible).to contain_exactly(green.relations)
+ expect(blue.relations.visible).to contain_exactly(blue.relations)
+ end
+ end
+ end
end
end