File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change 1111module ActiveRecord
1212 module CockroachDB
1313 class UnloggedTablesTest < ActiveRecord ::PostgreSQLTestCase
14- include SchemaDumpingHelper
1514
1615 TABLE_NAME = "things"
1716 LOGGED_FIELD = "relpersistence"
@@ -24,24 +23,18 @@ class Thing < ActiveRecord::Base
2423 self . table_name = TABLE_NAME
2524 end
2625
27- def setup
28- @connection = ActiveRecord ::Base . lease_connection
29- ActiveRecord ::ConnectionAdapters ::PostgreSQLAdapter . create_unlogged_tables = false
30- end
31-
32- teardown do
33- @connection . drop_table TABLE_NAME , if_exists : true
34- ActiveRecord ::ConnectionAdapters ::PostgreSQLAdapter . create_unlogged_tables = false
35- end
36-
3726 # Cockroachdb ignores the UNLOGGED specifier.
3827 # https://github.com/cockroachdb/cockroach/issues/56827
3928 def test_unlogged_in_test_environment_when_unlogged_setting_enabled
29+ @original_create_unlogged_tables = ActiveRecord ::ConnectionAdapters ::PostgreSQLAdapter . create_unlogged_tables
4030 ActiveRecord ::ConnectionAdapters ::PostgreSQLAdapter . create_unlogged_tables = true
31+ connection = ActiveRecord ::Base . lease_connection
4132
42- @ connection. create_table ( TABLE_NAME ) do |t |
33+ connection . create_table ( TABLE_NAME ) do |t |
4334 end
44- assert_equal @connection . execute ( LOGGED_QUERY ) . first [ LOGGED_FIELD ] , LOGGED
35+ assert_equal connection . execute ( LOGGED_QUERY ) . first [ LOGGED_FIELD ] , LOGGED
36+ ensure
37+ ActiveRecord ::ConnectionAdapters ::PostgreSQLAdapter . create_unlogged_tables = @original_create_unlogged_tables
4538 end
4639 end
4740 end
You can’t perform that action at this time.
0 commit comments