toggles 0.0.6 → 0.0.7
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: 021ee95f3fb8265217d9601170a5217b47660cf6
|
4
|
+
data.tar.gz: c91a3c28066e419b87776e39819dea4e1cc96f6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49bfb5d18dfbfdf227129a6503d338b2d919851798975674e097d44c2ff42e4ba06680c559f75a2bade07f5567844aeb04fafcffb59e4b0611a571f36e275987
|
7
|
+
data.tar.gz: e0653c4394f6bf883b43894e23df308bf8af04061387db2663a1982ae793a1b98e231b4f3a2bb65ff9fbb1233f66317471d90d40b51dd5c2cfd4b227fa06b1ac
|
data/lib/toggles/feature.rb
CHANGED
@@ -3,7 +3,11 @@ module Feature
|
|
3
3
|
class Or
|
4
4
|
def self.call(entity, attr_name, expected)
|
5
5
|
expected.any? do |operation, value|
|
6
|
-
OPERATIONS
|
6
|
+
if OPERATIONS.include? operation.to_sym
|
7
|
+
OPERATIONS[operation.to_sym].call(entity, attr_name, value)
|
8
|
+
else
|
9
|
+
Operation::Attribute.call(entity, operation, value)
|
10
|
+
end
|
7
11
|
end
|
8
12
|
end
|
9
13
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
describe Feature::OrAttributes do
|
2
|
+
specify do
|
3
|
+
expect(Feature::OrAttributes.enabled_for?(
|
4
|
+
user: double(foo: 20, bar: 10))).to eq true
|
5
|
+
expect(Feature::OrAttributes.enabled_for?(
|
6
|
+
user: double(foo: 10, bar: 30))).to eq true
|
7
|
+
|
8
|
+
expect(Feature::OrAttributes.enabled_for?(
|
9
|
+
user: double(foo: 10, bar: 10))).to eq false
|
10
|
+
end
|
11
|
+
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Tribone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- features/collection.yml
|
122
122
|
- features/multiple_subjects.yml
|
123
123
|
- features/nested_attributes.yml
|
124
|
+
- features/or_attributes.yml
|
124
125
|
- features/type.yml
|
125
126
|
- lib/toggles.rb
|
126
127
|
- lib/toggles/feature.rb
|
@@ -140,6 +141,7 @@ files:
|
|
140
141
|
- spec/toggles/feature/acceptance/collection_spec.rb
|
141
142
|
- spec/toggles/feature/acceptance/multiple_subjects_spec.rb
|
142
143
|
- spec/toggles/feature/acceptance/nested_attributes_spec.rb
|
144
|
+
- spec/toggles/feature/acceptance/or_attributes_spec.rb
|
143
145
|
- spec/toggles/feature/acceptance/type_spec.rb
|
144
146
|
- spec/toggles/feature/base_spec.rb
|
145
147
|
- spec/toggles/feature/operation/and_spec.rb
|
@@ -182,6 +184,7 @@ test_files:
|
|
182
184
|
- spec/toggles/feature/acceptance/collection_spec.rb
|
183
185
|
- spec/toggles/feature/acceptance/multiple_subjects_spec.rb
|
184
186
|
- spec/toggles/feature/acceptance/nested_attributes_spec.rb
|
187
|
+
- spec/toggles/feature/acceptance/or_attributes_spec.rb
|
185
188
|
- spec/toggles/feature/acceptance/type_spec.rb
|
186
189
|
- spec/toggles/feature/base_spec.rb
|
187
190
|
- spec/toggles/feature/operation/and_spec.rb
|