pundit-matchers 1.7.0 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pundit/matchers.rb +30 -0
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0da80bb866c35b8ab6548d017a9bc022831e3da0c5493b99aac0ba5c8c79cad
4
- data.tar.gz: 24bfacd140e3976e30c88204db5e33566c42dbd5e45d568c8d857a7a4205951d
3
+ metadata.gz: 8c7c0cd982bed7811a5fd87db4fd0dbc5c18c1503ee59e808946103b15c924e9
4
+ data.tar.gz: 461b744c49929c543a8cdd9e7dc4d06ff5465a506b26f4ef1744c6d93a9af414
5
5
  SHA512:
6
- metadata.gz: 5c1fbddf259fce9fa65c6f0613ec5d46e271ab0c7212380bc86cb5fef6fb85a2f74b6c20a4fb6b4c0e1dacc6b8ad11e1c963f8827c997e88bb319cce157d305b
7
- data.tar.gz: a2363786904df0631c54b8d84094179b61607e300a16ba53cd6406b02272e51f1e21060832f5b64a3eeaaba1ff6dba7c8462d3308732f335dc363df666058120
6
+ metadata.gz: 2e10a191199743912fa76c85c3cfdcd1ae97b555ba1ddb65c0d41877977b15e5c5724b392491cf713b23d175da46ea2bf976e4c7ced2d3043798f2c33e4bb37d
7
+ data.tar.gz: a925f3138bac77363d62c813def360cb45573b321513c305327bffb2746d517f68765ff5c36b84525e2ee7e8e134a6de36c349777dcd97cdbd685147fba6c890
@@ -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.7.0
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: 2021-07-04 00:00:00.000000000 Z
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/chrisalley/pundit-matchers
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.2.15
73
+ rubygems_version: 3.3.7
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: RSpec matchers for Pundit policies