diff --git a/test/cases/coerced_tests.rb b/test/cases/coerced_tests.rb index 4f06fd607..3ae40a74b 100644 --- a/test/cases/coerced_tests.rb +++ b/test/cases/coerced_tests.rb @@ -52,23 +52,40 @@ 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_double_dash_comment_containing_read_command_is_called_while_preventing_writes + def test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_containing_read_command_is_called_while_preventing_writes_coerced + Subscriber.send(:load_schema!) + original_test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_containing_read_command_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_double_dash_comment_is_called_while_preventing_writes + def test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_is_called_while_preventing_writes_coerced + Subscriber.send(:load_schema!) + original_test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_is_called_while_preventing_writes + end end end module ActiveRecord class AdapterPreventWritesLegacyTest < ActiveRecord::TestCase - # We do some read queries. Remove assert_no_queries + # 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 - @connection_handler.while_preventing_writes do - @connection.transaction do - assert_raises(ActiveRecord::ReadOnlyError) do - @connection.insert("/* some comment */ INSERT INTO subscribers(nick) VALUES ('138853948594')", nil, false) - end - end - end + Subscriber.send(:load_schema!) + original_test_errors_when_an_insert_query_prefixed_by_a_slash_star_comment_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_double_dash_comment_is_called_while_preventing_writes + def test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_is_called_while_preventing_writes_coerced + Subscriber.send(:load_schema!) + original_test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_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_double_dash_comment_containing_read_command_is_called_while_preventing_writes def test_errors_when_an_insert_query_prefixed_by_a_double_dash_comment_containing_read_command_is_called_while_preventing_writes_coerced Subscriber.send(:load_schema!)