Skip to content

Commit 396aef9

Browse files
authored
Merge pull request #975 from yellowspot/coerce-match-sql-query
[Rails 7] Coerce test to match sql server table quoting
2 parents 946dc6b + 0692d53 commit 396aef9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/cases/coerced_tests.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,3 +2051,22 @@ def test_upsert_all_implicitly_sets_timestamps_on_create_when_model_record_times
20512051
end
20522052
end
20532053
end
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

0 commit comments

Comments
 (0)