Skip to content

Commit

Permalink
Add #features to adapter wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnunemaker committed Sep 16, 2012
1 parent 568326a commit 8e753ae
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/flipper/adapter.rb
Expand Up @@ -101,6 +101,10 @@ def eql?(other)
end
alias :== :eql?

def features
set_members('features')
end

private

def cache(key)
Expand Down
21 changes: 21 additions & 0 deletions spec/flipper/adapter_spec.rb
Expand Up @@ -280,4 +280,25 @@
(subject == described_class.new(adapter)).should be_true
end
end

describe "#features" do
context "with no features enabled/disabled" do
it "defaults to empty set" do
subject.features.should eq(Set.new)
end
end

context "with features enabled and disabled" do
before do
subject.set_add('features', 'stats')
subject.set_add('features', 'cache')
subject.set_add('features', 'search')
end

it "returns set of feature names" do
subject.features.should be_instance_of(Set)
subject.features.sort.should eq(['cache', 'search', 'stats'])
end
end
end
end

0 comments on commit 8e753ae

Please sign in to comment.