From ed25cddff890e482df6480ae81e0c9efea746cfd Mon Sep 17 00:00:00 2001 From: Martin Schaflitzl Date: Fri, 13 Dec 2024 14:41:15 +0100 Subject: [PATCH] Update deprecation warning --- .../active_record/restriction/scalar_attribute.rb | 2 +- spec/assignable_values/active_record_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/assignable_values/active_record/restriction/scalar_attribute.rb b/lib/assignable_values/active_record/restriction/scalar_attribute.rb index 6ec40af..75fd1b1 100644 --- a/lib/assignable_values/active_record/restriction/scalar_attribute.rb +++ b/lib/assignable_values/active_record/restriction/scalar_attribute.rb @@ -88,7 +88,7 @@ def define_humanized_assignable_values_instance_method unless multiple define_method :"humanized_#{restriction.property.to_s.pluralize}" do - ActiveSupport::Deprecation.warn("humanized_s is deprecated, use humanized_assignable_s instead", caller) + ActiveSupport::Deprecation.new.warn("humanized_s is deprecated, use humanized_assignable_s instead", caller) restriction.humanized_assignable_values(self) end end diff --git a/spec/assignable_values/active_record_spec.rb b/spec/assignable_values/active_record_spec.rb index 5d8dc98..953c9b6 100644 --- a/spec/assignable_values/active_record_spec.rb +++ b/spec/assignable_values/active_record_spec.rb @@ -1277,7 +1277,7 @@ def genres %w[pop rock] end end - ActiveSupport::Deprecation.should_receive(:warn) + expect_any_instance_of(ActiveSupport::Deprecation).to receive(:warn) genres = klass.new.humanized_genres genres.collect(&:humanized).should == ['Pop music', 'Rock music'] end