spec/lib/incrementor_spec.rb in auto_increment-1.5.2 vs spec/lib/incrementor_spec.rb in auto_increment-1.6.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'spec_helper' describe AutoIncrement::Incrementor do { nil => 1, @@ -24,8 +26,27 @@ end it do allow(subject).to receive(:maximum) { nil } expect(subject.send(:increment)).to eq 'A' + end + end + + describe 'deprecates scope' do + subject { AutoIncrement::Incrementor.new :code, **options } + let(:options) { { scope: :account_id } } + + it 'issues a deprecation warning' do + expect(ActiveSupport::Deprecation).to receive(:warn).with(/Passing a scope to auto_increment is deprecated/) + subject + end + + context 'when @options[:scope] is not present' do + let(:options) { {} } + + it 'does not issue a deprecation warning' do + expect(ActiveSupport::Deprecation).not_to receive(:warn) + subject + end end end end