From 47b17f2991e9a9f58493ffebdc3242236a81a902 Mon Sep 17 00:00:00 2001 From: Abhay Nikam Date: Sat, 25 Apr 2020 20:20:40 +0530 Subject: [PATCH] Skip test cases for upsert_all on relation if database adapter doesn't support update on duplicate records --- activerecord/test/cases/insert_all_test.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/activerecord/test/cases/insert_all_test.rb b/activerecord/test/cases/insert_all_test.rb index 7cff2f822a..101923765f 100644 --- a/activerecord/test/cases/insert_all_test.rb +++ b/activerecord/test/cases/insert_all_test.rb @@ -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