Browse files

Remove DSL and Feature `#disabled?`

Just use enabled?. No point in supporting both.
  • Loading branch information...
1 parent ed8bb0a commit 97cf95cefa4c764a77949e67910755fc25aa41f8 @jnunemaker committed Feb 5, 2013
Showing with 1 addition and 53 deletions.
  1. +1 −1 README.md
  2. +0 −2 examples/dsl.rb
  3. +0 −10 lib/flipper/dsl.rb
  4. +0 −7 lib/flipper/feature.rb
  5. +0 −8 spec/flipper/dsl_spec.rb
  6. +0 −25 spec/flipper/feature_spec.rb
View
2 README.md
@@ -96,7 +96,7 @@ flipper[:stats].enable user
flipper[:stats].enabled? user # true
flipper[:stats].disable user
-flipper[:stats].disabled? user # true
+flipper[:stats].enabled? user # false
# you can enable anything, does not need to be user or person
flipper[:search].enable group
View
2 examples/dsl.rb
@@ -56,9 +56,7 @@ def initialize(id)
stats.disable
puts "stats.enabled?: #{stats.enabled?}"
-puts "stats.disabled?: #{stats.disabled?}"
puts "stats.enabled? person: #{stats.enabled? person}"
-puts "stats.disabled? person: #{stats.disabled? person}"
puts
# get an instance of the percentage of random type set to 5
View
10 lib/flipper/dsl.rb
@@ -30,16 +30,6 @@ def enabled?(name, *args)
feature(name).enabled?(*args)
end
- # Public: Check if a feature is disabled.
- #
- # name - The String or Symbol name of the feature.
- # args - The args passed through to the disabled check.
- #
- # Returns true if feature is disabled, false if not.
- def disabled?(name, *args)
- feature(name).disabled?(*args)
- end
-
# Public: Enable a feature.
#
# name - The String or Symbol name of the feature.
View
7 lib/flipper/feature.rb
@@ -60,13 +60,6 @@ def enabled?(thing = nil)
instrument(:enabled?, thing) { any_gates_open?(thing) }
end
- # Public: Check if a feature is disabled for a thing.
- #
- # Returns true if disabled, false if not.
- def disabled?(thing = nil)
- instrument(:disabled?, thing) { !any_gates_open?(thing) }
- end
-
# Internal: Gates to check to see if feature is enabled/disabled
#
# Returns an array of gates
View
8 spec/flipper/dsl_spec.rb
@@ -49,14 +49,6 @@
end
end
- describe "#disabled?" do
- it "passes arguments to feature disabled check and returns result" do
- admins_feature.should_receive(:disabled?).with(:foo).and_return(false)
- subject.should_receive(:feature).with(:stats).and_return(admins_feature)
- subject.disabled?(:stats, :foo).should be_false
- end
- end
-
describe "#enable" do
before do
subject.stub(:feature => admins_feature)
View
25 spec/flipper/feature_spec.rb
@@ -77,16 +77,6 @@
end
end
- context "#disabled?" do
- it "returns the opposite of any_gates_open" do
- subject.stub(:any_gates_open? => true)
- subject.disabled?.should be_false
-
- subject.stub(:any_gates_open? => false)
- subject.disabled?.should be_true
- end
- end
-
describe "#inspect" do
it "returns easy to read string representation" do
string = subject.inspect
@@ -148,21 +138,6 @@
event.payload[:thing].should eq(thing)
event.payload[:result].should be_false
end
-
- it "is recorded for disabled?" do
- thing = Flipper::Types::Boolean.new
- gate = subject.gate_for(thing)
-
- subject.disabled?(thing)
-
- event = instrumenter.events.last
- event.should_not be_nil
- event.name.should eq('feature_operation.flipper')
- event.payload[:feature_name].should eq(:search)
- event.payload[:operation].should eq(:disabled?)
- event.payload[:thing].should eq(thing)
- event.payload[:result].should be_true
- end
end
describe "#state" do

0 comments on commit 97cf95c

Please sign in to comment.