Permalink
Browse files

Merge pull request #23 from ayrton/fix-double-occurences-in-feature-list

Removes double occurence of features in feature list.
  • Loading branch information...
2 parents ace39e7 + 2bb0fd0 commit 70973c95b38d751a690690b4f1ad7b8af8865f22 @jamesgolick jamesgolick committed Jan 28, 2013
Showing with 12 additions and 4 deletions.
  1. +1 −1 lib/rollout.rb
  2. +11 −3 spec/rollout_spec.rb
View
2 lib/rollout.rb
@@ -180,7 +180,7 @@ def with_feature(feature)
def save(feature)
@storage.set(key(feature.name), feature.serialize)
- @storage.set(features_key, (features + [feature.name]).join(","))
+ @storage.set(features_key, (features | [feature.name]).join(","))
end
def migrate?
View
14 spec/rollout_spec.rb
@@ -206,9 +206,17 @@
end
end
- it "keeps a list of features" do
- @rollout.activate(:chat)
- @rollout.features.should be_include(:chat)
+ describe "keeps a list of features" do
+ it "saves the feature" do
+ @rollout.activate(:chat)
+ @rollout.features.should be_include(:chat)
+ end
+
+ it "does not contain doubles" do
+ @rollout.activate(:chat)
+ @rollout.activate(:chat)
+ @rollout.features.size.should == 1
+ end
end
describe "#get" do

0 comments on commit 70973c9

Please sign in to comment.