Skip to content

Commit c209fb3

Browse files
Merge pull request rails#50149 from fatkodima/fix-flaky-test
Fix flaky db warnings test
2 parents 54dc0b3 + 5375a91 commit c209fb3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

activerecord/test/cases/adapters/abstract_mysql_adapter/warnings_test.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,10 @@ def setup
7878
end
7979

8080
test "db_warnings_action allows a list of codes to ignore" do
81-
with_db_warnings_action(:raise, ["1062"]) do
82-
row_id = @connection.insert("INSERT INTO posts (title, body) VALUES('Title', 'Body')")
83-
result = @connection.execute("INSERT IGNORE INTO posts (id, title, body) VALUES(#{row_id}, 'Title', 'Body')")
81+
with_db_warnings_action(:raise, ["1292"]) do
82+
result = @connection.execute('SELECT 1 + "foo"')
8483

85-
assert_equal [], result.to_a
84+
assert_equal [1], result.to_a.first
8685
end
8786
end
8887

0 commit comments

Comments
 (0)