cancancan 1.13.0 → 1.13.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60da1f3c13774c65e5c622667c2a1472fffa0dbf
4
- data.tar.gz: 1e3f6fd8446e2560579d313980a7633efe8e8af1
3
+ metadata.gz: 59a95c6a9629c67f5004699cdbb205108d814ad5
4
+ data.tar.gz: 4f9cd96fcf1d2a3519b07605619240403b6b33eb
5
5
  SHA512:
6
- metadata.gz: f717a5d3e6c98cb11aad2e1fd38ccfa4d7848d1181f031d0c2e988200f77bda96df6997b9d5c18b8b62d50c0b0ebf0d0c8177b8b6b596443875b52c895820e65
7
- data.tar.gz: 504adef485e28df04ba9decd2902f38963886e9fe7e047125c15d8505b02fc0bb3f978d99f2306e154be3b8cb64dd1ad4ffdd7e8f0172950817841a67160f31b
6
+ metadata.gz: da1ce9db915cc5305d31d88c0c8f437088ceeab1f2b744a3a258923d59b6da743dd86a643a39c4602afe313c13cb39f1361d220144086a05913c41f5398428ed
7
+ data.tar.gz: 09c524f8d9928aa7029a9814fae9d45dcd8bf27ecf52f756cbafd02a716bc599f0ab12b4a3fdb37a71aa7ab5893b734b313989f1450a5d3792b77c9abdf7890a
@@ -2,6 +2,10 @@ Develop
2
2
 
3
3
  Unreleased
4
4
 
5
+ 1.13.1 (Oct 8th, 2015)
6
+
7
+ * Fix #merge with empty Ability (jhawthorn)
8
+
5
9
  1.13.0 (Oct 7th, 2015)
6
10
 
7
11
  * Significantly improve rule lookup time (amarshall)
@@ -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
- attr_reader :rules
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
- @rules ||= []
342
- @rules << rule
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)
@@ -1,3 +1,3 @@
1
1
  module CanCan
2
- VERSION = "1.13.0"
2
+ VERSION = "1.13.1"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cancancan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Rite