toggles 0.0.7 → 0.0.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 161f954b81d64d3d1942e3f6b189bd7a1de45da8
|
4
|
+
data.tar.gz: 6df537de28770b0a791b442afb3a7ac05439e0d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3605a942f1e9a914174d9d2f0683bbad7a8243ed2a0a2a39f8da0471c5a1e3710328255491ad3ece29c2356f776f342c72327dad9699dc50604f24be8e37fcc6
|
7
|
+
data.tar.gz: a43cf2b9a274517d8f5ae269b4ccce0fb7868182706c51144584069af7a936301a9862fcfe6bddc1b03f1a7213fc833cfd76ce9ec5e9df630eccf05243bc324c
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "ostruct"
|
2
|
+
require "forwardable"
|
2
3
|
|
3
4
|
module Feature
|
4
5
|
class Permissions
|
@@ -24,6 +25,10 @@ module Feature
|
|
24
25
|
rules.all? do |name, rule|
|
25
26
|
entity = entities[name.to_sym]
|
26
27
|
|
28
|
+
if entity.nil?
|
29
|
+
return false
|
30
|
+
end
|
31
|
+
|
27
32
|
if entity.class.ancestors.find { |ancestor| ancestor == Comparable }
|
28
33
|
entity = OpenStruct.new(name => entity)
|
29
34
|
rule = {name => rule}
|
@@ -5,5 +5,6 @@ describe Feature::Collection do
|
|
5
5
|
expect(Feature::Collection.enabled_for?(user: double(id: 10))).to eq true
|
6
6
|
expect(Feature::Collection.enabled_for?(user: double(id: 49))).to eq false
|
7
7
|
expect(Feature::Collection.enabled_for?(user: double(id: 51))).to eq true
|
8
|
+
expect(Feature::Collection.enabled_for?(user: nil)).to eq false
|
8
9
|
end
|
9
10
|
end
|
@@ -2,5 +2,6 @@ describe Feature::Operation::In do
|
|
2
2
|
specify do
|
3
3
|
expect(described_class.call(double(id: 50), :id, {"range" => [40, 60]})).to eq true
|
4
4
|
expect(described_class.call(double(id: 50), :id, [1])).to eq false
|
5
|
+
expect(described_class.call(double(id: nil), :id, [1])).to eq false
|
5
6
|
end
|
6
7
|
end
|
data/toggles.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toggles
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Tribone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|