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
Keep public permissions around in spec
Klaus Zanders1af13d044ade
diff --git a/lib/open_project/access_control.rb b/lib/open_project/access_control.rbindex 3d9ada3c900..5a10df26251 100644--- a/lib/open_project/access_control.rb+++ b/lib/open_project/access_control.rb@@ -70,7 +70,7 @@ module OpenProjectpermissions.detect { |p| p.controller_actions.include?(permission_path) }else- permissions.detect { |p| p.name == action }+ permissions.detect { |p| p.name == action&.to_sym }endenddiff --git a/spec/models/activities/fetcher_integration_spec.rb b/spec/models/activities/fetcher_integration_spec.rbindex f33f9ab83f5..267ff56eda9 100644--- a/spec/models/activities/fetcher_integration_spec.rb+++ b/spec/models/activities/fetcher_integration_spec.rb@@ -76,7 +76,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'finds only events for which permissions are satisfied' do# project attributes, news and message only require the user to be memberexpect(subject.map(&:journable_id))- .to match_array([project.id, message.id, news.id])+ .to contain_exactly(project.id, message.id, news.id)endend@@ -98,7 +98,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'finds only events matching the scope' doexpect(subject.map(&:journable_id))- .to match_array([message.id, time_entry.id])+ .to contain_exactly(message.id, time_entry.id)endendend@@ -114,13 +114,18 @@ RSpec.describe Activities::Fetcher, 'integration' docontext 'if lacking permissions' dobefore do- role.role_permissions.destroy_all+ role+ .role_permissions+ # n.b. public permissions are now stored in the database just like others, so to keep the tests like they are+ # we need to filter them out here+ .reject { |permission| OpenProject::AccessControl.permission(permission.permission).public? }+ .map(&:destroy)endit 'finds only events for which permissions are satisfied' do# project attributes, news and message only require the user to be memberexpect(subject.map(&:journable_id))- .to match_array([project.id, message.id, news.id])+ .to contain_exactly(project.id, message.id, news.id)endend@@ -142,7 +147,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'finds only events matching the scope' doexpect(subject.map(&:journable_id))- .to match_array([message.id, time_entry.id])+ .to contain_exactly(message.id, time_entry.id)endendend@@ -184,7 +189,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'lacks events from subproject' doexpect(subject.map(&:journable_id))- .to match_array [project.id, news.id, work_package.id]+ .to contain_exactly(project.id, news.id, work_package.id)endend@@ -193,7 +198,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'lacks events from subproject' doexpect(subject.map(&:journable_id))- .to match_array [project.id, news.id, work_package.id]+ .to contain_exactly(project.id, news.id, work_package.id)endend@@ -209,7 +214,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'finds only events for which permissions are satisfied' do# project attributes and news only require the user to be memberexpect(subject.map(&:journable_id))- .to match_array([project.id, subproject.id, news.id, subproject_news.id, work_package.id])+ .to contain_exactly(project.id, subproject.id, news.id, subproject_news.id, work_package.id)expect(subject.filter { |e| e.event_type.starts_with?('work_package') }.map(&:journable_id)).not_to include(subproject_work_package.id)end@@ -224,7 +229,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'lacks events from subproject' doexpect(subject.map(&:journable_id))- .to match_array [project.id, news.id, work_package.id]+ .to contain_exactly(project.id, news.id, work_package.id)endendend@@ -271,7 +276,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'finds only events for which permissions are satisfied' do# project attributes, news and message only require the user to be memberexpect(subject.map(&:journable_id))- .to match_array([project.id, message.id, news.id])+ .to contain_exactly(project.id, message.id, news.id)endend@@ -282,7 +287,7 @@ RSpec.describe Activities::Fetcher, 'integration' doit 'finds only events matching the scope' doexpect(subject.map(&:journable_id))- .to match_array([message.id, time_entry.id])+ .to contain_exactly(message.id, time_entry.id)endendend