cancancan 1.13.0 → 1.13.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.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +4 -0
- data/lib/cancan/ability.rb +5 -4
- data/lib/cancan/version.rb +1 -1
- data/spec/cancan/ability_spec.rb +7 -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: 59a95c6a9629c67f5004699cdbb205108d814ad5
|
4
|
+
data.tar.gz: 4f9cd96fcf1d2a3519b07605619240403b6b33eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da1ce9db915cc5305d31d88c0c8f437088ceeab1f2b744a3a258923d59b6da743dd86a643a39c4602afe313c13cb39f1361d220144086a05913c41f5398428ed
|
7
|
+
data.tar.gz: 09c524f8d9928aa7029a9814fae9d45dcd8bf27ecf52f756cbafd02a716bc599f0ab12b4a3fdb37a71aa7ab5893b734b313989f1450a5d3792b77c9abdf7890a
|
data/CHANGELOG.rdoc
CHANGED
data/lib/cancan/ability.rb
CHANGED
@@ -285,7 +285,9 @@ module CanCan
|
|
285
285
|
|
286
286
|
# Must be protected as an ability can merge with other abilities.
|
287
287
|
# This means that an ability must expose their rules with another ability.
|
288
|
-
|
288
|
+
def rules
|
289
|
+
@rules ||= []
|
290
|
+
end
|
289
291
|
|
290
292
|
private
|
291
293
|
|
@@ -338,9 +340,8 @@ module CanCan
|
|
338
340
|
end
|
339
341
|
|
340
342
|
def add_rule(rule)
|
341
|
-
|
342
|
-
|
343
|
-
add_rule_to_index(rule, @rules.size - 1)
|
343
|
+
rules << rule
|
344
|
+
add_rule_to_index(rule, rules.size - 1)
|
344
345
|
end
|
345
346
|
|
346
347
|
def add_rule_to_index(rule, position)
|
data/lib/cancan/version.rb
CHANGED
data/spec/cancan/ability_spec.rb
CHANGED
@@ -510,5 +510,12 @@ describe CanCan::Ability do
|
|
510
510
|
expect(@ability.can?(:use, :search)).to be(true)
|
511
511
|
expect(@ability.send(:rules).size).to eq(2)
|
512
512
|
end
|
513
|
+
|
514
|
+
it "can add an empty ability" do
|
515
|
+
(another_ability = double).extend(CanCan::Ability)
|
516
|
+
|
517
|
+
@ability.merge(another_ability)
|
518
|
+
expect(@ability.send(:rules).size).to eq(0)
|
519
|
+
end
|
513
520
|
end
|
514
521
|
end
|