From bbbe4392d530385358c39ca43518e0d0bee6b7b7 Mon Sep 17 00:00:00 2001 From: Aidan Haran Date: Wed, 28 Apr 2021 11:32:59 +0100 Subject: [PATCH] Load schema and call original test to prevent randomly failing test --- test/cases/coerced_tests.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/cases/coerced_tests.rb b/test/cases/coerced_tests.rb index e6cc9e24e..9e0e660f8 100644 --- a/test/cases/coerced_tests.rb +++ b/test/cases/coerced_tests.rb @@ -97,6 +97,13 @@ def test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_is_called module ActiveRecord class AdapterPreventWritesLegacyTest < ActiveRecord::TestCase + # Fix randomly failing test. The loading of the model's schema was affecting the test. + coerce_tests! :test_errors_when_an_insert_query_is_called_while_preventing_writes + def test_errors_when_an_insert_query_is_called_while_preventing_writes_coerced + Subscriber.send(:load_schema!) + original_test_errors_when_an_insert_query_is_called_while_preventing_writes + end + # Fix randomly failing test. The loading of the model's schema was affecting the test. coerce_tests! :test_errors_when_an_insert_query_prefixed_by_a_slash_star_comment_is_called_while_preventing_writes def test_errors_when_an_insert_query_prefixed_by_a_slash_star_comment_is_called_while_preventing_writes_coerced