auto_increment 1.6.0 → 1.6.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/auto_increment/incrementor.rb +0 -10
- data/lib/auto_increment/version.rb +1 -1
- data/spec/lib/incrementor_spec.rb +0 -19
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6940fc0d6bcea7dc3c707943c1e8c150478341ac85738be4554c308e8e254b1c
|
4
|
+
data.tar.gz: e49d98c47e8b2823b13fc10d79c7cb5f2a6c703dfaf25e4baf1e7bf099f14a39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c37ff7e20c1dabca443f1e1543da29e14203aebf69f97c2814c9d19b049e5a819c1936700966afadbd59f085e11a69dbf15a3336b45e8b5d5f6225c9b148808a
|
7
|
+
data.tar.gz: 39a037e16ec85e9626d5b658760539fdef96201d0a8e00a289c40f5b321630e142ab9547c9a25473d72720e581774974dc71df5ab857a5a9a4040fce38e52123
|
data/Gemfile.lock
CHANGED
@@ -14,8 +14,6 @@ module AutoIncrement
|
|
14
14
|
@options = options.reverse_merge initial: 1, force: false
|
15
15
|
@options[:scope] = [@options[:scope]].compact unless @options[:scope].is_a?(Array)
|
16
16
|
@options[:model_scope] = [@options[:model_scope]].compact unless @options[:model_scope].is_a?(Array)
|
17
|
-
|
18
|
-
deprecated_warning
|
19
17
|
end
|
20
18
|
|
21
19
|
def before_create(record)
|
@@ -78,13 +76,5 @@ module AutoIncrement
|
|
78
76
|
def string?
|
79
77
|
@options[:initial].instance_of?(String)
|
80
78
|
end
|
81
|
-
|
82
|
-
def deprecated_warning
|
83
|
-
return if @options[:scope].empty?
|
84
|
-
|
85
|
-
ActiveSupport::Deprecation.warn <<~WARNING.squish
|
86
|
-
Passing a scope to auto_increment is deprecated and will be removed in the next version. Please use model_scope instead.
|
87
|
-
WARNING
|
88
|
-
end
|
89
79
|
end
|
90
80
|
end
|
@@ -30,23 +30,4 @@ describe AutoIncrement::Incrementor do
|
|
30
30
|
expect(subject.send(:increment)).to eq 'A'
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
34
|
-
describe 'deprecates scope' do
|
35
|
-
subject { AutoIncrement::Incrementor.new :code, **options }
|
36
|
-
let(:options) { { scope: :account_id } }
|
37
|
-
|
38
|
-
it 'issues a deprecation warning' do
|
39
|
-
expect(ActiveSupport::Deprecation).to receive(:warn).with(/Passing a scope to auto_increment is deprecated/)
|
40
|
-
subject
|
41
|
-
end
|
42
|
-
|
43
|
-
context 'when @options[:scope] is not present' do
|
44
|
-
let(:options) { {} }
|
45
|
-
|
46
|
-
it 'does not issue a deprecation warning' do
|
47
|
-
expect(ActiveSupport::Deprecation).not_to receive(:warn)
|
48
|
-
subject
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
33
|
end
|