aboutsummaryrefslogtreecommitdiffstats
path: root/spec/support/pundit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/pundit')
-rw-r--r--spec/support/pundit/policies.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/support/pundit/policies.rb b/spec/support/pundit/policies.rb
index 637a2a528..e18309226 100644
--- a/spec/support/pundit/policies.rb
+++ b/spec/support/pundit/policies.rb
@@ -16,6 +16,7 @@ module Support
for_user.permissions ||= []
for_user.permissions += permissions.flatten
end
+
end
module PoliciesMacros
@@ -27,6 +28,12 @@ module Support
let( :user ) { create :user }
end
end
+ def with_user_permission(permission, &blk)
+ it "with user permission #{permission.inspect}" do
+ add_permissions(permission, for_user: user)
+ blk.()
+ end
+ end
end
end
end