pundit-matchers 1.2.3 → 1.3.0
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.
- checksums.yaml +4 -4
- data/lib/pundit/matchers.rb +12 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c6d515893a90543a9818a800398de7a5c03abbd
|
4
|
+
data.tar.gz: 97f2989074096be5df9b6875cf42d071296fd302
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c19a0dff1eaf4efcb1f6f8bd0e081dd8439344d27872c120df7aed9290addfb91bd685497a7a7d37432c0344bd5282b5b751b41e5d76583114937b8f3d4dbf1
|
7
|
+
data.tar.gz: b954d73c45e45b4c97242e91971940933d7cc5203fcc651affa8a10e9b4a1dd2e436c919818622b9ca4f5a9543f094a68d83285181ce337ecde705248ac15fa0
|
data/lib/pundit/matchers.rb
CHANGED
@@ -2,9 +2,13 @@ require 'rspec/core'
|
|
2
2
|
|
3
3
|
module Pundit
|
4
4
|
module Matchers
|
5
|
-
RSpec::Matchers.define :forbid_action do |action|
|
5
|
+
RSpec::Matchers.define :forbid_action do |action, *args|
|
6
6
|
match do |policy|
|
7
|
-
|
7
|
+
if args.any?
|
8
|
+
!policy.public_send("#{action}?", *args)
|
9
|
+
else
|
10
|
+
!policy.public_send("#{action}?")
|
11
|
+
end
|
8
12
|
end
|
9
13
|
|
10
14
|
failure_message do |policy|
|
@@ -128,9 +132,13 @@ module Pundit
|
|
128
132
|
end
|
129
133
|
end
|
130
134
|
|
131
|
-
RSpec::Matchers.define :permit_action do |action|
|
135
|
+
RSpec::Matchers.define :permit_action do |action, *args|
|
132
136
|
match do |policy|
|
133
|
-
|
137
|
+
if args.any?
|
138
|
+
policy.public_send("#{action}?", *args)
|
139
|
+
else
|
140
|
+
policy.public_send("#{action}?")
|
141
|
+
end
|
134
142
|
end
|
135
143
|
|
136
144
|
failure_message do |policy|
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Alley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pundit
|