offs 1.3.0 → 1.4.0
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/lib/offs/flags.rb +6 -1
- data/lib/offs/version.rb +1 -1
- data/spec/offs_spec.rb +26 -5
- 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: 205ff73781d83a027350f1de8da287e0a8fec834
|
4
|
+
data.tar.gz: 4f6e7f8bdd804461590bdbbd0b81b54f36748b08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72aaffded2072d1316c5bb33b6c235d113e1737a7db79d52d643f6e6879d0f538b70f2b5f6ef65d5e431f2766f6b8f7a12f9fab75b0f28206cb0f4dd181d9305
|
7
|
+
data.tar.gz: a73eff40479677cc647c291c166b9ada2e79465da6b582673478abfa9957d60cc4f527504a538d14420474a3b200024833123242b68de906815bf0128a2ca548
|
data/lib/offs/flags.rb
CHANGED
data/lib/offs/version.rb
CHANGED
data/spec/offs_spec.rb
CHANGED
@@ -16,6 +16,7 @@ describe OFFS do
|
|
16
16
|
let(:feature_flags) {
|
17
17
|
OFFS::Flags.set do |f|
|
18
18
|
f.flag :my_cool_new_feature, feature_status
|
19
|
+
f.flag :my_runtime_feature, ->{ feature_status }
|
19
20
|
end
|
20
21
|
}
|
21
22
|
|
@@ -47,9 +48,7 @@ describe OFFS do
|
|
47
48
|
end
|
48
49
|
end
|
49
50
|
|
50
|
-
|
51
|
-
let(:feature_status) { true }
|
52
|
-
|
51
|
+
shared_examples_for 'the feature is enabled' do
|
53
52
|
it 'executes the would_like_to block' do
|
54
53
|
expect(would_like_to_blk).to receive(:call)
|
55
54
|
do_it
|
@@ -86,9 +85,19 @@ describe OFFS do
|
|
86
85
|
end
|
87
86
|
end
|
88
87
|
|
89
|
-
context "and the feature is turned
|
90
|
-
let(:feature_status) {
|
88
|
+
context "and the feature is turned on by default" do
|
89
|
+
let(:feature_status) { true }
|
90
|
+
|
91
|
+
it_behaves_like 'the feature is enabled'
|
92
|
+
|
93
|
+
context "and the feature status is a Proc" do
|
94
|
+
let(:flag) { :my_runtime_feature }
|
95
|
+
|
96
|
+
it_behaves_like 'the feature is enabled'
|
97
|
+
end
|
98
|
+
end
|
91
99
|
|
100
|
+
shared_examples_for 'the feature is disabled' do
|
92
101
|
it "executes the may_still_need_to block" do
|
93
102
|
expect(may_still_need_to_blk).to receive(:call)
|
94
103
|
do_it
|
@@ -125,5 +134,17 @@ describe OFFS do
|
|
125
134
|
raise_error(OFFS::FeatureDisabled, /my_cool_new_feature/)
|
126
135
|
end
|
127
136
|
end
|
137
|
+
|
138
|
+
context "and the feature is turned off by default" do
|
139
|
+
let(:feature_status) { false }
|
140
|
+
|
141
|
+
it_behaves_like 'the feature is disabled'
|
142
|
+
|
143
|
+
context "and the feature status is a Proc" do
|
144
|
+
let(:flag) { :my_runtime_feature }
|
145
|
+
|
146
|
+
it_behaves_like 'the feature is disabled'
|
147
|
+
end
|
148
|
+
end
|
128
149
|
end
|
129
150
|
end
|