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

Skip test cases for upsert_all on relation if database adapter doesn't support update on duplicate records

This commit is contained in:
Abhay Nikam 2020-04-25 20:20:40 +05:30
parent 358ac36edf
commit 47b17f2991

View file

@ -373,6 +373,8 @@ class InsertAllTest < ActiveRecord::TestCase
end
def test_upsert_all_on_relation
skip unless supports_insert_on_duplicate_update?
author = Author.create!(name: "Jimmy")
assert_difference "author.books.count", +1 do
@ -381,6 +383,8 @@ class InsertAllTest < ActiveRecord::TestCase
end
def test_upsert_all_on_relation_precedence
skip unless supports_insert_on_duplicate_update?
author = Author.create!(name: "Jimmy")
second_author = Author.create!(name: "Bob")
@ -390,6 +394,8 @@ class InsertAllTest < ActiveRecord::TestCase
end
def test_upsert_all_create_with
skip unless supports_insert_on_duplicate_update?
assert_difference "Book.where(format: 'X').count", +2 do
Book.create_with(format: "X").upsert_all([ { name: "A" }, { name: "B" } ])
end