flip 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34cfbf4baa553b42ce4f101ce8298398d6eaa5ba
4
- data.tar.gz: 163b976f96549dfd35fa5c85c439a842a4017f61
3
+ metadata.gz: da01ea06aa9d7689818dfaa77f99757c190501bf
4
+ data.tar.gz: 416f3d9d8bbe884a0a3cc4b83ebce94b102d7f4f
5
5
  SHA512:
6
- metadata.gz: a32e4a7920731d9dd5609175882e81e3e4432b3c3e3dfe88a0b9156d09d7d601db64bb91192c76324ad9ed81bf5a114b3a34d44e71388f0ff384b893c4d8b0ef
7
- data.tar.gz: 919e30b3ea94327d91d5ff54089890103be251fdf66ff3a48d4db84544f5b9cad51bc7383ced1df579f85951e0eb0e60b376ba08e3f103b470cd023a17a417cf
6
+ metadata.gz: 26350753c4fd704b07e713d03b057adb2e97c035ea75a0357e70900a0b1eaaa357227aba0591b1aea944c2e81bd62484da319496165deba00b8ef2a4cc5bf16b
7
+ data.tar.gz: fe1cc381d2d4684b9d429a41c53d1d54aa377507b2089b07c695b1703cd8e94c7d3b8a14d3b8c3a5f76e7e5c2e459695f248c403f59cc092e16c7f009fcc5a45
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.1.0
3
4
  - 2.0.0
4
5
  - 1.9.3
5
6
  - jruby-19mode
6
- - rbx-19mode
data/README.md CHANGED
@@ -138,10 +138,10 @@ class Admin::FeaturesController < Flip::FeaturesController
138
138
  end
139
139
  ```
140
140
 
141
- app/controllers/admin/feature_strategies_controller.rb:
141
+ app/controllers/admin/strategies_controller.rb:
142
142
 
143
143
  ```ruby
144
- class Admin::FeatureStrategiesController < Flip::FeaturesController
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 :feature_strategies, only: [ :update, :destroy ]
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.update_attributes!(
27
- enabled: enable
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
@@ -1,3 +1,3 @@
1
1
  module Flip
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -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.should_receive(:update_attributes!).with(enabled: true)
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.should_receive(:update_attributes!).with(enabled: false)
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.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-02-25 00:00:00.000000000 Z
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