flipper-active_record 0.17.1 → 0.17.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 580a17c75e03a7c98a7361a34f24ae82124491bf02e1351972bd1f6d5b627f79
4
- data.tar.gz: f9a57fae9ea74c31101e3e461e0afbd622977351fae841428b35f746badfc803
3
+ metadata.gz: 6d3bd79fbfb00866cf27a49c6536f83e294e84199433a297bde832f87d4e6792
4
+ data.tar.gz: cdef915d7638974a6f5a528394e0917fcd5d47a43902320688bfff61d33fd251
5
5
  SHA512:
6
- metadata.gz: 71e7004c6d628e0fe95f3e2d1adaa85d572a557d139634562bb79ccb76a2fd986778773c0aa7895d87db398a16483e6ecf3b3dc26cd067ff7919e810232ab78a
7
- data.tar.gz: 05b9b9d298593eddcacb447ac3270a9685bdc25881b67ca37a89c944626e631178ece3910b2931a0b6cb5a7ca553579830f486cd5f2093dfd618e8d978d4eec9
6
+ metadata.gz: e28f948df8c2ba80a1bb35fa302369d6ef945a8dec6a631b27c68151b65c2fb339999a6777acd9eb024771ca3f953e1dd28bc7098c59deb6e330110ae11d8084
7
+ data.tar.gz: b50696f59dc7b509a44ffd5a0daa37bdcaba56e19c95ef06a0fc36e45de112b6d2c4ac4da0c5d75bd34e80d1f913862f41b960499e910671ec53171f7fe83a9a
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
19
19
  'lib/flipper/version.rb',
20
20
  ]
21
21
  gem.files = `git ls-files`.split("\n").select(&flipper_active_record_files) + extra_files
22
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_record_files) # rubocop:disable Metrics/LineLength
22
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_active_record_files) # rubocop:disable Layout/LineLength
23
23
  gem.name = 'flipper-active_record'
24
24
  gem.require_paths = ['lib']
25
25
  gem.version = Flipper::VERSION
@@ -59,7 +59,7 @@ module Flipper
59
59
  unless @feature_class.where(key: feature.key).first
60
60
  begin
61
61
  @feature_class.create! { |f| f.key = feature.key }
62
- rescue ActiveRecord::RecordNotUnique
62
+ rescue ::ActiveRecord::RecordNotUnique
63
63
  end
64
64
  end
65
65
  end
@@ -125,7 +125,9 @@ module Flipper
125
125
  # Returns true.
126
126
  def enable(feature, gate, thing)
127
127
  case gate.data_type
128
- when :boolean, :integer
128
+ when :boolean
129
+ set(feature, gate, thing, clear: true)
130
+ when :integer
129
131
  set(feature, gate, thing)
130
132
  when :set
131
133
  enable_multi(feature, gate, thing)
@@ -165,8 +167,10 @@ module Flipper
165
167
 
166
168
  private
167
169
 
168
- def set(feature, gate, thing)
170
+ def set(feature, gate, thing, options = {})
171
+ clear_feature = options.fetch(:clear, false)
169
172
  @gate_class.transaction do
173
+ clear(feature) if clear_feature
170
174
  @gate_class.where(feature_key: feature.key, key: gate.key).destroy_all
171
175
  @gate_class.create! do |g|
172
176
  g.feature_key = feature.key
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.17.1'.freeze
2
+ VERSION = '0.17.2'.freeze
3
3
  end
@@ -0,0 +1,5 @@
1
+ # This nominally-empty spec ensures that the file "flipper-active_record.rb" can be
2
+ # required without error, and guards against regressions of the kind fixed in
3
+ # https://github.com/jnunemaker/flipper/pull/437.
4
+
5
+ require "flipper-active_record.rb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.17.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-14 00:00:00.000000000 Z
11
+ date: 2020-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flipper
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.17.1
19
+ version: 0.17.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.17.1
26
+ version: 0.17.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activerecord
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -61,6 +61,7 @@ files:
61
61
  - lib/flipper/version.rb
62
62
  - lib/generators/flipper/active_record_generator.rb
63
63
  - lib/generators/flipper/templates/migration.erb
64
+ - spec/flipper/adapters/active_record_requires_spec.rb
64
65
  - spec/flipper/adapters/active_record_spec.rb
65
66
  - test/adapters/active_record_test.rb
66
67
  - test_rails/generators/flipper/active_record_generator_test.rb
@@ -89,5 +90,6 @@ signing_key:
89
90
  specification_version: 4
90
91
  summary: ActiveRecord adapter for Flipper
91
92
  test_files:
93
+ - spec/flipper/adapters/active_record_requires_spec.rb
92
94
  - spec/flipper/adapters/active_record_spec.rb
93
95
  - test/adapters/active_record_test.rb