diff options
| author | Robert | 2017-05-23 12:49:39 +0200 |
|---|---|---|
| committer | Robert | 2017-05-23 18:10:10 +0200 |
| commit | 49e8c9b65f953bf725a39193797266ac4ac717f1 (patch) | |
| tree | 331b5c6794b4260b70cb91d360168f21e0e8f293 /spec/support/pundit.rb | |
| parent | 9b3961f69fd35105ded3b5a8f7d0055dc7443b82 (diff) | |
| download | chouette-core-49e8c9b65f953bf725a39193797266ac4ac717f1.tar.bz2 | |
Refs: #3383; boiv intermediate policy speced and implmntd
- Policy spex specific support code moved to spec/support/pundit
- Shared Xample group for policies permitting access depening on one specific permission and organisation_match
Diffstat (limited to 'spec/support/pundit.rb')
| -rw-r--r-- | spec/support/pundit.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/spec/support/pundit.rb b/spec/support/pundit.rb deleted file mode 100644 index 2147c27aa..000000000 --- a/spec/support/pundit.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'pundit/rspec' - -module Support - module ApplicationPolicy - def add_permissions(*permissions, for_user:) - for_user.permissions ||= [] - for_user.permissions += permissions.flatten - end - - def create_user_context(user:, referential:) - OpenStruct.new(user: user, context: {referential: referential}) - end - - def add_permissions(*permissions, for_user:) - for_user.permissions ||= [] - for_user.permissions += permissions.flatten - end - end - - module ApplicationPolicyMacros - def self.extended into - into.module_eval do - subject { described_class } - let( :user_context ) { create_user_context(user: user, referential: referential) } - let( :referentail ) { create :referential } - let( :user ) { create :user } - end - end - end -end - -RSpec.configure do | c | - c.include Support::ApplicationPolicy, type: :policy - c.extend Support::ApplicationPolicyMacros, type: :policy -end |
