From 904f9ab1a17c4b076a7608d9dd5fe5c058127712 Mon Sep 17 00:00:00 2001 From: Dombi Attila Date: Tue, 19 Apr 2022 19:17:38 +0200 Subject: [PATCH] fixup! Migrate team planner permissions --- .../migrate_team_planner_permissions_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/migrations/migrate_team_planner_permissions_spec.rb b/spec/migrations/migrate_team_planner_permissions_spec.rb index ea691f3a88..394a3ace14 100644 --- a/spec/migrations/migrate_team_planner_permissions_spec.rb +++ b/spec/migrations/migrate_team_planner_permissions_spec.rb @@ -46,6 +46,7 @@ describe MigrateTeamPlannerPermissions, type: :model do shared_examples_for 'migration is idempotent' do context 'when the migration is ran twice' do before { subject } + it_behaves_like 'not changing permissions' end end @@ -62,7 +63,7 @@ describe MigrateTeamPlannerPermissions, type: :model do end end - context 'for a role with unrelated permissions' do + context 'for a role not eligible to view_team_planner' do let!(:role) { create(:role, permissions: %i[permission1 permission2]) } it_behaves_like 'not changing permissions' @@ -85,6 +86,17 @@ describe MigrateTeamPlannerPermissions, type: :model do it_behaves_like 'migration is idempotent' end + context 'for a role not eligible to manage_team_planner' do + let(:permissions) do + %i[view_team_planner view_work_packages edit_work_packages + save_queries manage_public_queries permission1 permission2] + end + let!(:role) { create(:role, permissions: permissions) } + + it_behaves_like 'not changing permissions' + it_behaves_like 'migration is idempotent' + end + context 'for a role eligible to manage_team_planner having view_team_planner' do let(:permissions) do %i[view_team_planner view_work_packages add_work_packages edit_work_packages