featurer 0.0.3 → 0.0.4

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: 6cb600d87fa0d7bb593241b52b70d13b563a61f6
4
- data.tar.gz: 5381460ea6488704484711d075b1d72357dc1c62
3
+ metadata.gz: 9df68ddc8f5f914b1893afb7156d3a88d8b24697
4
+ data.tar.gz: cb25475d7fb0d5e2ea0cdf697c26c9744d9197ce
5
5
  SHA512:
6
- metadata.gz: d9fb938b9f5df59f8b71332d481b03845f3c6bd4179aa1619b7523002cc91c486240a8f40d0e0d29facbf5b811543b3740d751510725d4cb823deba64fc92260
7
- data.tar.gz: 987eaefaaa92f73309581fa25a07286648613779a670651069f31ab8bda47c13809fc6d633e8167e8a3eed8c03685b7e9884fdc317a5a942798e4f5059492b15
6
+ metadata.gz: 85061688766dc09e391bfb439dcc945517a85bbc3e9711c9064c6ba530b999451df0ff3d6cf32e624e9c4eaced4c1c0b54c559abe2152ea0d5f9a3f648feb0d2
7
+ data.tar.gz: 504147f604eb16472905c1c05c66ecb040841390a3c30d592d4b6df913c7cd6a77f59b26b0f2499bb22f711140797d23811a0b9b260559a3c57eaea707c25be3
data/README.md CHANGED
@@ -67,10 +67,18 @@ Then request the enabled feature:
67
67
  Featurer.on?(:feature, user_id)
68
68
  ```
69
69
 
70
+ To add more users later on:
71
+
72
+ ```ruby
73
+ Featurer.add(:feature, first_user_id)
74
+ Featurer.add(:feature, [second_user_id, third_user_id])
75
+ ```
76
+
70
77
  In order to remove a user from a feature:
71
78
 
72
79
  ```ruby
73
80
  Featurer.off(:feature, user_id)
81
+ Featurer.off(:feature, [first_user_id, second_user_id])
74
82
  ```
75
83
 
76
84
  #### Global feature
@@ -85,12 +93,6 @@ Then request the enabled feature:
85
93
  Featurer.on? :feature
86
94
  ```
87
95
 
88
- In order to remove multiple users from a feature:
89
-
90
- ```ruby
91
- Featurer.off(:feature, [first_user_id, second_user_id])
92
- ```
93
-
94
96
  #### Deleting features
95
97
 
96
98
  ```ruby
@@ -117,6 +119,14 @@ class TestAdapter < Featurer::Adapter
117
119
  # your logic
118
120
  end
119
121
 
122
+ def add(name, value)
123
+ # your logic
124
+ end
125
+
126
+ def off(name)
127
+ # your logic
128
+ end
129
+
120
130
  def delete(name)
121
131
  # your logic
122
132
  end
@@ -14,6 +14,10 @@ module Featurer
14
14
  delete_key(feature)
15
15
  end
16
16
 
17
+ def add(feature, value)
18
+ save_set(feature, value)
19
+ end
20
+
17
21
  def on?(feature, value = true)
18
22
  fetch_from_set(feature, value)
19
23
  end
@@ -1,3 +1,3 @@
1
1
  module Featurer
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -50,6 +50,29 @@ describe Featurer do
50
50
  expect(Featurer.on?(:feature, user_id)).to_not be
51
51
  expect(Featurer.on?(:feature, user_id + 1)).to_not be
52
52
  end
53
+
54
+ it 'should add a user to a non-existing feature' do
55
+ Featurer.add :feature, user_id
56
+
57
+ expect(Featurer.on?(:feature, user_id)).to be
58
+ end
59
+
60
+ it 'should add a single user to a feature' do
61
+ Featurer.register :feature, [user_id]
62
+ Featurer.add :feature, user_id + 1
63
+
64
+ expect(Featurer.on?(:feature, user_id)).to be
65
+ expect(Featurer.on?(:feature, user_id + 1)).to be
66
+ end
67
+
68
+ it 'should add multiple users to a feature' do
69
+ Featurer.register :feature, [user_id]
70
+ Featurer.add :feature, [user_id + 1, user_id + 2]
71
+
72
+ expect(Featurer.on?(:feature, user_id)).to be
73
+ expect(Featurer.on?(:feature, user_id + 1)).to be
74
+ expect(Featurer.on?(:feature, user_id + 2)).to be
75
+ end
53
76
  end
54
77
 
55
78
  describe 'global' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featurer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro El Informatico