1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add regression tests for 859fba7c4b

This commit is contained in:
Ryuta Kamizono 2020-06-20 16:04:47 +09:00
parent 0eccda0d2d
commit b535a455a8
2 changed files with 18 additions and 2 deletions

View file

@ -56,7 +56,15 @@ class DeleteAllTest < ActiveRecord::TestCase
pets = Pet.joins(:toys).where(toys: { name: "Bone" })
assert_equal true, pets.exists?
assert_equal pets.count, pets.delete_all
sqls = capture_sql do
assert_equal pets.count, pets.delete_all
end
if current_adapter?(:Mysql2Adapter)
assert_no_match %r/SELECT DISTINCT #{Regexp.escape(Pet.connection.quote_table_name("pets.pet_id"))}/, sqls.last
else
assert_match %r/SELECT #{Regexp.escape(Pet.connection.quote_table_name("pets.pet_id"))}/, sqls.last
end
end
def test_delete_all_with_joins_and_where_part_is_not_hash

View file

@ -46,7 +46,15 @@ class UpdateAllTest < ActiveRecord::TestCase
pets = Pet.joins(:toys).where(toys: { name: "Bone" })
assert_equal true, pets.exists?
assert_equal pets.count, pets.update_all(name: "Bob")
sqls = capture_sql do
assert_equal pets.count, pets.update_all(name: "Bob")
end
if current_adapter?(:Mysql2Adapter)
assert_no_match %r/SELECT DISTINCT #{Regexp.escape(Pet.connection.quote_table_name("pets.pet_id"))}/, sqls.last
else
assert_match %r/SELECT #{Regexp.escape(Pet.connection.quote_table_name("pets.pet_id"))}/, sqls.last
end
end
def test_update_all_with_left_joins