File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change @@ -2653,3 +2653,34 @@ def test_url_invalid_adapter_coerced
26532653 end
26542654 end
26552655end
2656+
2657+ module ActiveRecord
2658+ class TableMetadataTest < ActiveSupport ::TestCase
2659+ # Adapter returns an object that is subclass of what is expected in the original test.
2660+ coerce_tests! %r{#associated_table creates the right type caster for joined table with different association name}
2661+ def associated_table_creates_the_right_type_caster_for_joined_table_with_different_association_name_coerced
2662+ base_table_metadata = TableMetadata . new ( AuditRequiredDeveloper , Arel ::Table . new ( "developers" ) )
2663+
2664+ associated_table_metadata = base_table_metadata . associated_table ( "audit_logs" )
2665+
2666+ assert associated_table_metadata . arel_table . type_for_attribute ( :message ) . is_a? ( ActiveRecord ::Type ::String )
2667+ end
2668+ end
2669+ end
2670+
2671+ module ActiveRecord
2672+ module TypeCaster
2673+ class ConnectionTest < ActiveSupport ::TestCase
2674+ # Adapter returns an object that is subclass of what is expected in the original test.
2675+ coerce_tests! %r{#type_for_attribute is not aware of custom types}
2676+ def type_for_attribute_is_not_aware_of_custom_types_coerced
2677+ type_caster = Connection . new ( AttributedDeveloper , "developers" )
2678+
2679+ type = type_caster . type_for_attribute ( :name )
2680+
2681+ assert_not_equal DeveloperName , type . class
2682+ assert type . is_a? ( ActiveRecord ::Type ::String )
2683+ end
2684+ end
2685+ end
2686+ end
Original file line number Diff line number Diff line change 1515require "support/query_assertions"
1616require "mocha/minitest"
1717
18+ module ActiveSupport
19+ class TestCase < ::Minitest ::Test
20+ include ARTest ::SQLServer ::CoerceableTest
21+ end
22+ end
23+
1824module ActiveRecord
1925 class TestCase < ActiveSupport ::TestCase
2026 SQLServer = ActiveRecord ::ConnectionAdapters ::SQLServer
2127
22- include ARTest ::SQLServer ::CoerceableTest ,
23- ARTest ::SQLServer ::ConnectionReflection ,
28+ include ARTest ::SQLServer ::ConnectionReflection ,
2429 ActiveSupport ::Testing ::Stream ,
2530 ARTest ::SQLServer ::QueryAssertions
2631
You can’t perform that action at this time.
0 commit comments