From 3d5db4920a3d5fb0bdd4a912fd5e29eec12ef02e Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 2 Jan 2019 08:42:50 +0900 Subject: Add test case for `preventing_writes?` Since the `preventing_writes?` is public API. --- activerecord/test/cases/adapter_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activerecord/test/cases/adapter_test.rb') diff --git a/activerecord/test/cases/adapter_test.rb b/activerecord/test/cases/adapter_test.rb index 66e594d771..05d8aa59c4 100644 --- a/activerecord/test/cases/adapter_test.rb +++ b/activerecord/test/cases/adapter_test.rb @@ -163,6 +163,16 @@ module ActiveRecord end end + def test_preventing_writes_predicate + assert_not_predicate @connection, :preventing_writes? + + @connection.while_preventing_writes do + assert_predicate @connection, :preventing_writes? + end + + assert_not_predicate @connection, :preventing_writes? + end + def test_errors_when_an_insert_query_is_called_while_preventing_writes assert_no_queries do assert_raises(ActiveRecord::ReadOnlyError) do -- cgit v1.2.3