aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/permissions.rb4
-rw-r--r--spec/support/pundit/shared_examples.rb20
2 files changed, 22 insertions, 2 deletions
diff --git a/spec/support/permissions.rb b/spec/support/permissions.rb
index 7d09e16cb..dde530871 100644
--- a/spec/support/permissions.rb
+++ b/spec/support/permissions.rb
@@ -26,8 +26,8 @@ module Support
vehicle_journeys
api_keys
compliance_controls
- compliance_controls_sets
- compliance_controls_blocks
+ compliance_control_sets
+ compliance_control_blocks
compliance_check_sets
]
end
diff --git a/spec/support/pundit/shared_examples.rb b/spec/support/pundit/shared_examples.rb
index 49c6845da..49f915626 100644
--- a/spec/support/pundit/shared_examples.rb
+++ b/spec/support/pundit/shared_examples.rb
@@ -129,3 +129,23 @@ RSpec.shared_examples 'permitted policy' do
end
end
end
+
+RSpec.shared_examples 'permitted policy outside referential' do
+ | permission |
+
+ context 'permission absent → ' do
+ it "denies user" do
+ expect_it.not_to permit(user_context, record)
+ end
+ end
+
+ context 'permission present → ' do
+ before do
+ add_permissions(permission, to_user: user)
+ end
+
+ it 'allows user' do
+ expect_it.to permit(user_context, record)
+ end
+ end
+end \ No newline at end of file