flip 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.travis.yml +1 -1
- data/README.md +3 -3
- data/lib/flip/database_strategy.rb +3 -3
- data/lib/flip/version.rb +1 -1
- data/spec/database_strategy_spec.rb +4 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da01ea06aa9d7689818dfaa77f99757c190501bf
|
4
|
+
data.tar.gz: 416f3d9d8bbe884a0a3cc4b83ebce94b102d7f4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26350753c4fd704b07e713d03b057adb2e97c035ea75a0357e70900a0b1eaaa357227aba0591b1aea944c2e81bd62484da319496165deba00b8ef2a4cc5bf16b
|
7
|
+
data.tar.gz: fe1cc381d2d4684b9d429a41c53d1d54aa377507b2089b07c695b1703cd8e94c7d3b8a14d3b8c3a5f76e7e5c2e459695f248c403f59cc092e16c7f009fcc5a45
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -138,10 +138,10 @@ class Admin::FeaturesController < Flip::FeaturesController
|
|
138
138
|
end
|
139
139
|
```
|
140
140
|
|
141
|
-
app/controllers/admin/
|
141
|
+
app/controllers/admin/strategies_controller.rb:
|
142
142
|
|
143
143
|
```ruby
|
144
|
-
class Admin::
|
144
|
+
class Admin::StrategiesController < Flip::StrategiesController
|
145
145
|
before_filter :assert_authenticated_as_admin
|
146
146
|
end
|
147
147
|
```
|
@@ -151,7 +151,7 @@ routes.rb:
|
|
151
151
|
```ruby
|
152
152
|
namespace :admin do
|
153
153
|
resources :features, only: [ :index ] do
|
154
|
-
resources :
|
154
|
+
resources :strategies, only: [ :update, :destroy ]
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
@@ -23,9 +23,9 @@ module Flip
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def switch! key, enable
|
26
|
-
@klass.where(key: key.to_s).first_or_initialize
|
27
|
-
|
28
|
-
|
26
|
+
record = @klass.where(key: key.to_s).first_or_initialize
|
27
|
+
record.enabled = enable
|
28
|
+
record.save!
|
29
29
|
end
|
30
30
|
|
31
31
|
def delete! key
|
data/lib/flip/version.rb
CHANGED
@@ -57,12 +57,14 @@ describe Flip::DatabaseStrategy do
|
|
57
57
|
describe "#switch!" do
|
58
58
|
it "can switch a feature on" do
|
59
59
|
expect(db_result).to receive(:first_or_initialize).and_return(disabled_record)
|
60
|
-
disabled_record.
|
60
|
+
expect(disabled_record).to receive(:enabled=).with(true)
|
61
|
+
expect(disabled_record).to receive(:save!)
|
61
62
|
strategy.switch! :one, true
|
62
63
|
end
|
63
64
|
it "can switch a feature off" do
|
64
65
|
expect(db_result).to receive(:first_or_initialize).and_return(enabled_record)
|
65
|
-
enabled_record.
|
66
|
+
expect(enabled_record).to receive(:enabled=).with(false)
|
67
|
+
expect(enabled_record).to receive(:save!)
|
66
68
|
strategy.switch! :one, false
|
67
69
|
end
|
68
70
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Annesley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -81,6 +81,7 @@ extensions: []
|
|
81
81
|
extra_rdoc_files: []
|
82
82
|
files:
|
83
83
|
- ".gitignore"
|
84
|
+
- ".rspec"
|
84
85
|
- ".travis.yml"
|
85
86
|
- Gemfile
|
86
87
|
- README.md
|