featurer 0.1.0 → 0.1.1

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: b841a0cb7f4bdda8b8484436e69c086ed3c356e8
4
- data.tar.gz: b3cef4ae265b6de20e91b174923e676afaaa2dbf
3
+ metadata.gz: 229df6bdbec627a7618b56cab5bfde8771c28689
4
+ data.tar.gz: 14aca1cb4f1eb24914320f5471024e5031c450ff
5
5
  SHA512:
6
- metadata.gz: 77548e6ba64d74da3a3f94a309084469e9fe6fffdd9f1b4bdae38aa632bbc589f872de9bd66ccffe1be7e1d74dbdbc0c7a326b5305dba4da6a8ca713393db89f
7
- data.tar.gz: 8ea8674ab337fbb44b1eccdd95da7d5cde70d22a251c871569143ad21834da0ea77b657d930d1d5dc3b27668ed7b83aca74bdb98dd54237d044ac4c9c6fd90d1
6
+ metadata.gz: 6cb0799b3aee303df9d5a1bc95ad261435f9dbeb2431a90dd3bc3a258f5df21fdfe09b13f13fcc9eb157326e4b83d65122f8e0d3db8089b2a20327f87ea0fde4
7
+ data.tar.gz: 0774e3c0335f70e605e327e591cf7caf55c9b086edc93ad3193b3d59a9663ab6b7415f7052803181631f1f630c8c49295158c56c4ded6706b873e3edb7a9158a
@@ -36,7 +36,8 @@ module Featurer
36
36
  end
37
37
 
38
38
  def register(feature, value = true)
39
- # ensure old data is wiped
39
+ return if feature.nil? || feature.empty?
40
+
40
41
  delete(feature)
41
42
  save_set(feature, value)
42
43
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Featurer
4
- VERSION = '0.1.0'.freeze
4
+ VERSION = '0.1.1'.freeze
5
5
  end
@@ -75,4 +75,38 @@ describe Featurer::RedisAdapter do
75
75
  end
76
76
  end
77
77
  end
78
+
79
+ describe '#register' do
80
+ shared_examples 'rejected feature' do
81
+ it "doesn't register the feature" do
82
+ expect(subject).not_to receive(:delete)
83
+ expect(subject).not_to receive(:save_set)
84
+
85
+ subject.register(feature)
86
+ end
87
+ end
88
+
89
+ context 'feature name is not empty' do
90
+ let(:feature) { 'awesome_feature' }
91
+
92
+ it 'registers the feature' do
93
+ expect(subject).to receive(:delete).with(feature)
94
+ expect(subject).to receive(:save_set).with(feature, true)
95
+
96
+ subject.register(feature)
97
+ end
98
+ end
99
+
100
+ context 'feature name is empty' do
101
+ let(:feature) { '' }
102
+
103
+ it_behaves_like 'rejected feature'
104
+ end
105
+
106
+ context 'feature name is nil' do
107
+ let(:feature) { nil }
108
+
109
+ it_behaves_like 'rejected feature'
110
+ end
111
+ end
78
112
  end
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alejandro El Informatico