mongoid_ability 0.1.8 → 0.1.9
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/mongoid_ability/lock.rb +1 -1
- data/lib/mongoid_ability/version.rb +1 -1
- data/test/mongoid_ability/lock_test.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0c87d76d294916f069dcdb8a809d9870b1c87a6
|
4
|
+
data.tar.gz: b130d99ea2c2e54ecfd341ce7ccb880144e4399a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d097c614650c1898fee81b49fd967e8bc7f1f2790d3b306ba07a59079b7533d27a79fec4a02b55cc68ab3ab7399e715bbc330f6fd5169f740d6cfc7815ba8ef
|
7
|
+
data.tar.gz: 023453a517e10711cafc17a6a4efbe7ff4a0ead1dd90b820c7cfa5ae493badc2b69e98d26acded7a297ca2bc1d854cedaf0059dbfc7f7a4fdc9b330629b59558
|
data/lib/mongoid_ability/lock.rb
CHANGED
@@ -42,7 +42,7 @@ module MongoidAbility
|
|
42
42
|
|
43
43
|
# calculates outcome as if this lock is not present
|
44
44
|
def inherited_outcome
|
45
|
-
return unless owner.present?
|
45
|
+
return calculated_outcome unless owner.present?
|
46
46
|
cloned_owner = owner.clone
|
47
47
|
cloned_owner.locks_relation = cloned_owner.locks_relation - [self]
|
48
48
|
MongoidAbility::Ability.new(cloned_owner).can? action, (id_lock? ? subject : subject_class)
|
@@ -66,6 +66,11 @@ module MongoidAbility
|
|
66
66
|
subject_lock.inherited_outcome.must_equal false
|
67
67
|
subject_type_lock.inherited_outcome.must_equal true
|
68
68
|
end
|
69
|
+
|
70
|
+
it 'returns calculated_outcome for default locks' do
|
71
|
+
lock = MySubject.default_locks.detect{ |l| l.action == :read }
|
72
|
+
lock.inherited_outcome.must_equal true
|
73
|
+
end
|
69
74
|
end
|
70
75
|
|
71
76
|
# ---------------------------------------------------------------------
|