From ae73637e35db20d0c4e14959d8c1274e5399278e Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Fri, 5 May 2017 18:07:12 +0930 Subject: Clarify deprecation message for #quoted_id In this case, it's the method definition that's more at fault, rather than the current caller. --- activerecord/test/cases/quoting_test.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/quoting_test.rb b/activerecord/test/cases/quoting_test.rb index f260d043e4..f647526fbc 100644 --- a/activerecord/test/cases/quoting_test.rb +++ b/activerecord/test/cases/quoting_test.rb @@ -81,8 +81,21 @@ module ActiveRecord end end + class QuotedOne + def quoted_id + 1 + end + end + class SubQuotedOne < QuotedOne + end def test_quote_with_quoted_id - assert_deprecated { assert_equal 1, @quoter.quote(Struct.new(:quoted_id).new(1)) } + assert_deprecated /defined on \S+::QuotedOne at .*quoting_test\.rb:[0-9]/ do + assert_equal 1, @quoter.quote(QuotedOne.new) + end + + assert_deprecated /defined on \S+::SubQuotedOne\(\S+::QuotedOne\) at .*quoting_test\.rb:[0-9]/ do + assert_equal 1, @quoter.quote(SubQuotedOne.new) + end end def test_quote_nil -- cgit v1.2.3