@@ -1341,6 +1341,14 @@ def test_registering_new_handlers_for_association_coerced
13411341 assert_match %r{#{ Regexp . escape ( topic_title ) } ~ N'rails'}i , Reply . joins ( :topic ) . where ( topics : { title : /rails/ } ) . to_sql
13421342 end
13431343
1344+ # Same as original test except string has `N` prefix to indicate unicode string.
1345+ coerce_tests! :test_registering_new_handlers_for_joins
1346+ def test_registering_new_handlers_for_joins_coerced
1347+ Reply . belongs_to :regexp_topic , -> { where ( title : /rails/ ) } , class_name : "Topic" , foreign_key : "parent_id"
1348+
1349+ assert_match %r{#{ Regexp . escape ( quote_table_name ( "regexp_topic.title" ) ) } ~ N'rails'}i , Reply . joins ( :regexp_topic ) . references ( Arel . sql ( "regexp_topic" ) ) . to_sql
1350+ end
1351+
13441352 private
13451353
13461354 def topic_title
@@ -2177,17 +2185,6 @@ class EnumTest < ActiveRecord::TestCase
21772185 Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
21782186 end
21792187
2180- # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
2181- coerce_tests! %r{declare multiple enums at a time}
2182- test "declare multiple enums at a time coerced" do
2183- Book . lease_connection . remove_index ( :books , column : [ :author_id , :name ] )
2184-
2185- send ( :'original_declare multiple enums at a time' )
2186- ensure
2187- Book . where ( author_id : nil , name : nil ) . delete_all
2188- Book . lease_connection . add_index ( :books , [ :author_id , :name ] , unique : true )
2189- end
2190-
21912188 # Need to remove index as SQL Server considers NULLs on a unique-index to be equal unlike PostgreSQL/MySQL/SQLite.
21922189 coerce_tests! %r{serializable\? with large number label}
21932190 test "serializable? with large number label coerced" do
@@ -2669,6 +2666,28 @@ def test_url_invalid_adapter_coerced
26692666 end
26702667end
26712668
2669+ module ActiveRecord
2670+ module ConnectionAdapters
2671+ class RegistrationIsolatedTest < ActiveRecord ::TestCase
2672+ # SQL Server was not included in the list of available adapters in the error message.
2673+ coerce_tests! %r{resolve raises if the adapter is using the pre 7.2 adapter registration API}
2674+ def resolve_raises_if_the_adapter_is_using_the_pre_7_2_adapter_registration_API
2675+ exception = assert_raises ( ActiveRecord ::AdapterNotFound ) do
2676+ ActiveRecord ::ConnectionAdapters . resolve ( "fake_legacy" )
2677+ end
2678+
2679+ assert_equal (
2680+ "Database configuration specifies nonexistent 'ridiculous' adapter. Available adapters are: abstract, fake, mysql2, postgresql, sqlite3, sqlserver, trilogy. Ensure that the adapter is spelled correctly in config/database.yml and that you've added the necessary adapter gem to your Gemfile if it's not in the list of available adapters." ,
2681+ exception . message
2682+ )
2683+ ensure
2684+ ActiveRecord ::ConnectionAdapters . instance_variable_get ( :@adapters ) . delete ( "fake_legacy" )
2685+ end
2686+ end
2687+ end
2688+ end
2689+
2690+
26722691module ActiveRecord
26732692 class TableMetadataTest < ActiveSupport ::TestCase
26742693 # Adapter returns an object that is subclass of what is expected in the original test.
0 commit comments