action_policy 0.4.1 → 0.4.2
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/CHANGELOG.md +1 -1
- data/lib/action_policy/testing.rb +1 -12
- data/lib/action_policy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 946e026afb064f557ce87761fb4ddb981635d0b95ca5f8a6415ae7572932f758
|
4
|
+
data.tar.gz: c97a78ac4be2b1482280c70345caa881d4b6d126e1d92c7b8e852592ccca09ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5585386d303ef8af41651a3951fadd6970d4a127226a88b7c220852235d8f7cd34f7b608ef1390ed02b921fe64f93abc9d0ddc2d2f0780293e7b925818830d17
|
7
|
+
data.tar.gz: '0954283e4e9576ced888c80e1e02bec3fa2c128f69f79962ba748b69aa6fbab0c46814746a9ac6fe36dd2609dc9a626fb4ee51848b84a5ebe3a584838e2eeb9e'
|
data/CHANGELOG.md
CHANGED
@@ -3,17 +3,6 @@
|
|
3
3
|
module ActionPolicy
|
4
4
|
# Testing utils
|
5
5
|
module Testing
|
6
|
-
# Hack to match both classes and composed matchers:
|
7
|
-
# be_authorized_to(:create?, User)
|
8
|
-
# be_authorized_to(:maanage?, an_instance_of(User))
|
9
|
-
using(Module.new do
|
10
|
-
refine Module do
|
11
|
-
def ===(other)
|
12
|
-
self == other
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end)
|
16
|
-
|
17
6
|
# Collects all Authorizer calls
|
18
7
|
module AuthorizeTracker
|
19
8
|
class Call # :nodoc:
|
@@ -26,7 +15,7 @@ module ActionPolicy
|
|
26
15
|
|
27
16
|
def matches?(policy_class, actual_rule, target)
|
28
17
|
policy_class == policy.class &&
|
29
|
-
target === policy.record &&
|
18
|
+
(target.is_a?(Class) ? target == policy.record : target === policy.record) &&
|
30
19
|
rule == actual_rule
|
31
20
|
end
|
32
21
|
|