paddock 0.1.0 → 0.2.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.
Files changed (3) hide show
  1. data/lib/paddock.rb +9 -0
  2. data/spec/paddock_spec.rb +17 -0
  3. metadata +2 -2
@@ -32,9 +32,18 @@ module Paddock
32
32
  end
33
33
 
34
34
  def self.features(&block)
35
+ @block = block
35
36
  instance_eval(&block)
36
37
  end
37
38
 
39
+ def self.reset!
40
+ if block = @block
41
+ features(&block)
42
+ else
43
+ raise "No paddock block defined!"
44
+ end
45
+ end
46
+
38
47
  def self.enable(name, options={})
39
48
  Paddock::Feature.add(name, (options[:in] || :all))
40
49
  end
@@ -191,4 +191,21 @@ describe Paddock('development') do
191
191
  called.should be_true
192
192
  end
193
193
  end
194
+
195
+ describe "resetting changes" do
196
+ before(:each) do
197
+ Paddock('development') do
198
+ disable :disabled_feature
199
+ enable :enabled_feature
200
+ end
201
+ end
202
+
203
+ it "restores original feature behavior" do
204
+ Paddock.disable :enabled_feature
205
+ feature(:enabled_feature).should be_false
206
+
207
+ Paddock.reset!
208
+ feature(:enabled_feature).should be_true
209
+ end
210
+ end
194
211
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pat Nakajima & Brandon Keene