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 @@ -2056,3 +2056,22 @@ def test_upsert_all_implicitly_sets_timestamps_on_create_when_model_record_times
20562056 end
20572057 end
20582058end
2059+
2060+ class HasOneThroughDisableJoinsAssociationsTest < ActiveRecord ::TestCase
2061+ # TODO: Remove coerce after Rails 7.1.0 (see https://github.com/rails/rails/pull/44051)
2062+ coerce_tests! :test_disable_joins_through_with_enum_type
2063+ def test_disable_joins_through_with_enum_type_coerced
2064+ joins = capture_sql { @member . club }
2065+ no_joins = capture_sql { @member . club_without_joins }
2066+
2067+ assert_equal 1 , joins . size
2068+ assert_equal 2 , no_joins . size
2069+
2070+ assert_match ( /INNER JOIN/ , joins . first )
2071+ no_joins . each do |nj |
2072+ assert_no_match ( /INNER JOIN/ , nj )
2073+ end
2074+
2075+ assert_match ( /\[ memberships\] \. \[ type\] / , no_joins . first )
2076+ end
2077+ end
You can’t perform that action at this time.
0 commit comments