提交 36b639bd 编写于 作者: E Eugene Kenny

Skip insert all tests when features are unavailable

These tests are causing the Ruby master build to fail in CI. The Docker
image we use is based on Ubuntu Bionic which provides SQLite 3.22.0, and
the features required to use `insert_all` and `upsert_all` are not
available in that version.
上级 04843621
...@@ -651,6 +651,8 @@ def test_insert ...@@ -651,6 +651,8 @@ def test_insert
end end
def test_insert_all def test_insert_all
skip unless supports_insert_on_duplicate_skip?
assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do
Task.cache { Task.insert({ starting: Time.now }) } Task.cache { Task.insert({ starting: Time.now }) }
end end
...@@ -658,7 +660,9 @@ def test_insert_all ...@@ -658,7 +660,9 @@ def test_insert_all
assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do
Task.cache { Task.insert_all([{ starting: Time.now }]) } Task.cache { Task.insert_all([{ starting: Time.now }]) }
end end
end
def test_insert_all_bang
assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do
Task.cache { Task.insert!({ starting: Time.now }) } Task.cache { Task.insert!({ starting: Time.now }) }
end end
...@@ -666,6 +670,10 @@ def test_insert_all ...@@ -666,6 +670,10 @@ def test_insert_all
assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do
Task.cache { Task.insert_all!([{ starting: Time.now }]) } Task.cache { Task.insert_all!([{ starting: Time.now }]) }
end end
end
def test_upsert_all
skip unless supports_insert_on_duplicate_update?
assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do assert_called(ActiveRecord::Base.connection, :clear_query_cache, times: 2) do
Task.cache { Task.upsert({ starting: Time.now }) } Task.cache { Task.upsert({ starting: Time.now }) }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册