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:
parent
358ac36edf
commit
47b17f2991
1 changed files with 6 additions and 0 deletions
|
@ -373,6 +373,8 @@ class InsertAllTest < ActiveRecord::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_upsert_all_on_relation
|
def test_upsert_all_on_relation
|
||||||
|
skip unless supports_insert_on_duplicate_update?
|
||||||
|
|
||||||
author = Author.create!(name: "Jimmy")
|
author = Author.create!(name: "Jimmy")
|
||||||
|
|
||||||
assert_difference "author.books.count", +1 do
|
assert_difference "author.books.count", +1 do
|
||||||
|
@ -381,6 +383,8 @@ class InsertAllTest < ActiveRecord::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_upsert_all_on_relation_precedence
|
def test_upsert_all_on_relation_precedence
|
||||||
|
skip unless supports_insert_on_duplicate_update?
|
||||||
|
|
||||||
author = Author.create!(name: "Jimmy")
|
author = Author.create!(name: "Jimmy")
|
||||||
second_author = Author.create!(name: "Bob")
|
second_author = Author.create!(name: "Bob")
|
||||||
|
|
||||||
|
@ -390,6 +394,8 @@ class InsertAllTest < ActiveRecord::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_upsert_all_create_with
|
def test_upsert_all_create_with
|
||||||
|
skip unless supports_insert_on_duplicate_update?
|
||||||
|
|
||||||
assert_difference "Book.where(format: 'X').count", +2 do
|
assert_difference "Book.where(format: 'X').count", +2 do
|
||||||
Book.create_with(format: "X").upsert_all([ { name: "A" }, { name: "B" } ])
|
Book.create_with(format: "X").upsert_all([ { name: "A" }, { name: "B" } ])
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue