File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -2051,3 +2051,22 @@ def test_upsert_all_implicitly_sets_timestamps_on_create_when_model_record_times
20512051 end
20522052 end
20532053end
2054+
2055+ class HasOneThroughDisableJoinsAssociationsTest < ActiveRecord ::TestCase
2056+ # TODO: Remove coerce after Rails 7.1.0 (see https://github.com/rails/rails/pull/44051)
2057+ coerce_tests! :test_disable_joins_through_with_enum_type
2058+ def test_disable_joins_through_with_enum_type_coerced
2059+ joins = capture_sql { @member . club }
2060+ no_joins = capture_sql { @member . club_without_joins }
2061+
2062+ assert_equal 1 , joins . size
2063+ assert_equal 2 , no_joins . size
2064+
2065+ assert_match ( /INNER JOIN/ , joins . first )
2066+ no_joins . each do |nj |
2067+ assert_no_match ( /INNER JOIN/ , nj )
2068+ end
2069+
2070+ assert_match ( /\[ memberships\] \. \[ type\] / , no_joins . first )
2071+ end
2072+ end
You can’t perform that action at this time.
0 commit comments