featurer 0.0.3 → 0.0.4
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/README.md +16 -6
- data/lib/featurer/adapters/redis.rb +4 -0
- data/lib/featurer/version.rb +1 -1
- data/spec/lib/featurer_spec.rb +23 -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: 9df68ddc8f5f914b1893afb7156d3a88d8b24697
|
4
|
+
data.tar.gz: cb25475d7fb0d5e2ea0cdf697c26c9744d9197ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/featurer/version.rb
CHANGED
data/spec/lib/featurer_spec.rb
CHANGED
@@ -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
|