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 a test that the permission on the WP does not leak into the project

Klaus Zanders216ca411c7c5
diff --git a/spec/models/users/allowed_to_spec.rb b/spec/models/users/allowed_to_spec.rb
index be40eb529f1..d924fd5c26b 100644
--- a/spec/models/users/allowed_to_spec.rb
+++ b/spec/models/users/allowed_to_spec.rb
@@ -109,6 +109,21 @@ RSpec.describe User, 'allowed_to?' do
context 'with the project being private' do
before { project.update(public: false) }
+ context 'with the user being a member of a single work package inside the project' do
+ before do
+ work_package.save!
+ wp_member.save!
+ end
+
+ context 'with the role granting the permission' do
+ before do
+ wp_role.add_permission!(permission)
+ end
+
+ it { expect(user).not_to be_allowed_to(permission, project) }
+ end
+ end
+
context 'and the permission being assigend to the non-member role' do
before do
non_member = Role.non_member