diff options
| author | cedricnjanga | 2017-11-22 00:45:48 +0100 |
|---|---|---|
| committer | cedricnjanga | 2017-11-22 00:45:48 +0100 |
| commit | 510afa8b86fb6f5e4b7d9c39e3a6d3b071cd8ce9 (patch) | |
| tree | 1b3a162722389df4f6b2e444d03e91131032f0d5 /spec/support | |
| parent | be2bd2e4f902ef12a21425ebe7dcf5699768762a (diff) | |
| parent | 96afaed78fa043449c0264ea09f0106147755c8e (diff) | |
| download | chouette-core-510afa8b86fb6f5e4b7d9c39e3a6d3b071cd8ce9.tar.bz2 | |
Merge branch 'master' into 4941-refactoring_object_id
Diffstat (limited to 'spec/support')
| -rw-r--r-- | spec/support/permissions.rb | 4 | ||||
| -rw-r--r-- | spec/support/pundit/shared_examples.rb | 20 |
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 |
