@@ -205,6 +205,17 @@ def test_belongs_to_with_primary_key_joins_on_correct_column_coerced
205205 assert_no_match ( /\[ firm_with_primary_keys_companies\] \. \[ id\] / , sql )
206206 assert_match ( /\[ firm_with_primary_keys_companies\] \. \[ name\] / , sql )
207207 end
208+
209+ # Asserted SQL to get one row different from original test.
210+ coerce_tests! :test_belongs_to
211+ def test_belongs_to_coerced
212+ client = Client . find ( 3 )
213+ first_firm = companies ( :first_firm )
214+ assert_sql ( /FETCH NEXT @(\d ) ROWS ONLY(.)*@\1 = 1/ ) do
215+ assert_equal first_firm , client . firm
216+ assert_equal first_firm . name , client . firm . name
217+ end
218+ end
208219end
209220
210221
@@ -656,7 +667,7 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
656667 def test_has_one_coerced
657668 firm = companies ( :first_firm )
658669 first_account = Account . find ( 1 )
659- assert_sql ( /FETCH NEXT @1 ROWS ONLY(.)*@1 = 1/ ) do
670+ assert_sql ( /FETCH NEXT @( \d ) ROWS ONLY(.)*@\ 1 = 1/ ) do
660671 assert_equal first_account , firm . account
661672 assert_equal first_account . credit_limit , firm . account . credit_limit
662673 end
@@ -671,7 +682,7 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase
671682 coerce_tests! :test_has_one_through_executes_limited_query
672683 def test_has_one_through_executes_limited_query_coerced
673684 boring_club = clubs ( :boring_club )
674- assert_sql ( /FETCH NEXT @3 ROWS ONLY(.)*@3 = 1/ ) do
685+ assert_sql ( /FETCH NEXT @( \d ) ROWS ONLY(.)*@\1 = 1/ ) do
675686 assert_equal boring_club , @member . general_club
676687 end
677688 end
@@ -680,21 +691,6 @@ def test_has_one_through_executes_limited_query_coerced
680691
681692
682693
683- class BelongsToAssociationsTest < ActiveRecord ::TestCase
684- # Asserted SQL to get one row different from original test.
685- coerce_tests! :test_belongs_to
686- def test_belongs_to_coerced
687- client = Client . find ( 3 )
688- first_firm = companies ( :first_firm )
689- assert_sql ( /FETCH NEXT @3 ROWS ONLY(.)*@3 = 1/ ) do
690- assert_equal first_firm , client . firm
691- assert_equal first_firm . name , client . firm . name
692- end
693- end
694- end
695-
696-
697-
698694
699695require 'models/company'
700696class InheritanceTest < ActiveRecord ::TestCase
0 commit comments