Skip to content

Commit 204bc98

Browse files
authored
Updated test to match Rails original (#1185)
1 parent f38562b commit 204bc98

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

test/cases/coerced_tests.rb

+10-12
Original file line numberDiff line numberDiff line change
@@ -2197,25 +2197,23 @@ def test_insert_all_coerced
21972197
Task.cache { Task.insert({ starting: Time.now }) }
21982198
end
21992199

2200-
assert_called(ActiveRecord::Base.lease_connection, :clear_query_cache, times: 2) do
2201-
Task.cache { Task.insert_all!([{ starting: Time.now }]) }
2202-
end
2203-
2204-
assert_called(ActiveRecord::Base.lease_connection, :clear_query_cache, times: 2) do
2205-
Task.cache { Task.insert!({ starting: Time.now }) }
2206-
end
2207-
2208-
assert_called(ActiveRecord::Base.lease_connection, :clear_query_cache, times: 2) do
2209-
Task.cache { Task.insert_all!([{ starting: Time.now }]) }
2210-
end
2211-
22122200
assert_raises(ArgumentError, /does not support upsert/) do
22132201
Task.cache { Task.upsert({ starting: Time.now }) }
22142202
end
22152203

22162204
assert_raises(ArgumentError, /does not support upsert/) do
22172205
Task.cache { Task.upsert_all([{ starting: Time.now }]) }
22182206
end
2207+
2208+
Task.cache do
2209+
assert_called(ActiveRecord::Base.connection_pool.query_cache, :clear, times: 1) do
2210+
Task.insert_all!([ starting: Time.now ])
2211+
end
2212+
2213+
assert_called(ActiveRecord::Base.connection_pool.query_cache, :clear, times: 1) do
2214+
Task.insert!({ starting: Time.now })
2215+
end
2216+
end
22192217
end
22202218
end
22212219

0 commit comments

Comments
 (0)