pundit-matchers 1.7.0 → 1.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pundit/matchers.rb +30 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c7c0cd982bed7811a5fd87db4fd0dbc5c18c1503ee59e808946103b15c924e9
|
4
|
+
data.tar.gz: 461b744c49929c543a8cdd9e7dc4d06ff5465a506b26f4ef1744c6d93a9af414
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e10a191199743912fa76c85c3cfdcd1ae97b555ba1ddb65c0d41877977b15e5c5724b392491cf713b23d175da46ea2bf976e4c7ced2d3043798f2c33e4bb37d
|
7
|
+
data.tar.gz: a925f3138bac77363d62c813def360cb45573b321513c305327bffb2746d517f68765ff5c36b84525e2ee7e8e134a6de36c349777dcd97cdbd685147fba6c890
|
data/lib/pundit/matchers.rb
CHANGED
@@ -2,6 +2,12 @@ require 'rspec/core'
|
|
2
2
|
|
3
3
|
module Pundit
|
4
4
|
module Matchers
|
5
|
+
require 'pundit/matchers/utils/policy_info'
|
6
|
+
require 'pundit/matchers/utils/all_actions/forbidden_actions_error_formatter'
|
7
|
+
require 'pundit/matchers/utils/all_actions/forbidden_actions_matcher'
|
8
|
+
require 'pundit/matchers/utils/all_actions/permitted_actions_error_formatter'
|
9
|
+
require 'pundit/matchers/utils/all_actions/permitted_actions_matcher'
|
10
|
+
|
5
11
|
class Configuration
|
6
12
|
attr_accessor :user_alias
|
7
13
|
|
@@ -364,6 +370,30 @@ module Pundit
|
|
364
370
|
.inspect + '.'
|
365
371
|
end
|
366
372
|
end
|
373
|
+
|
374
|
+
RSpec::Matchers.define :permit_all_actions do
|
375
|
+
match do |policy|
|
376
|
+
@matcher = Pundit::Matchers::Utils::AllActions::PermittedActionsMatcher.new(policy)
|
377
|
+
@matcher.match?
|
378
|
+
end
|
379
|
+
|
380
|
+
failure_message do
|
381
|
+
formatter = Pundit::Matchers::Utils::AllActions::PermittedActionsErrorFormatter.new(@matcher)
|
382
|
+
formatter.message
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
RSpec::Matchers.define :forbid_all_actions do
|
387
|
+
match do |policy|
|
388
|
+
@matcher = Pundit::Matchers::Utils::AllActions::ForbiddenActionsMatcher.new(policy)
|
389
|
+
@matcher.match?
|
390
|
+
end
|
391
|
+
|
392
|
+
failure_message do
|
393
|
+
formatter = Pundit::Matchers::Utils::AllActions::ForbiddenActionsErrorFormatter.new(@matcher)
|
394
|
+
formatter.message
|
395
|
+
end
|
396
|
+
end
|
367
397
|
end
|
368
398
|
|
369
399
|
if defined?(Pundit)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pundit-matchers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Alley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-rails
|
@@ -51,7 +51,7 @@ extensions: []
|
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
53
|
- lib/pundit/matchers.rb
|
54
|
-
homepage: http://github.com/
|
54
|
+
homepage: http://github.com/punditcommunity/pundit-matchers
|
55
55
|
licenses:
|
56
56
|
- MIT
|
57
57
|
metadata: {}
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
|
-
rubygems_version: 3.
|
73
|
+
rubygems_version: 3.3.7
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: RSpec matchers for Pundit policies
|