@@ -10,21 +10,13 @@ def test_dumping_schema_with_index
1010 connection = ActiveRecord ::Base . connection
1111 connection . add_index :entries , :title
1212 StringIO . open do |io |
13- ActiveRecord ::SchemaDumper . dump ( connection , io )
13+ ActiveRecord ::SchemaDumper . dump ( db_pool , io )
1414 assert_match ( /"index_entries_on_title"/ , io . string )
1515 end
1616 ensure
1717 connection . remove_index :entries , :title
1818 end
1919
20- def standard_dump ( io = StringIO . new , ignore_tables = [ ] )
21- io = StringIO . new
22- ActiveRecord ::SchemaDumper . ignore_tables = ignore_tables
23- ActiveRecord ::SchemaDumper . dump ( ActiveRecord ::Base . connection , io )
24- io . string
25- end
26- private :standard_dump
27-
2820 def test_magic_comment
2921 standard_dump ( strio = StringIO . new )
3022 assert_match "# encoding: #{ strio . external_encoding . name } " , standard_dump
@@ -60,7 +52,7 @@ def test_schema_dump_with_string_ignored_table
6052 stream = StringIO . new
6153
6254 ActiveRecord ::SchemaDumper . ignore_tables = [ 'users' ]
63- ActiveRecord ::SchemaDumper . dump ( ActiveRecord :: Base . connection , stream )
55+ ActiveRecord ::SchemaDumper . dump ( db_pool , stream )
6456 output = stream . string
6557 assert_no_match %r{create_table "users"} , output
6658 assert_match %r{create_table "entries"} , output
@@ -135,4 +127,16 @@ def test_schema_dump_with_table_name_prefix_and_suffix
135127 ActiveRecord ::Base . table_name_suffix = ActiveRecord ::Base . table_name_prefix = ''
136128 end
137129
130+ private
131+
132+ def standard_dump ( io = StringIO . new , ignore_tables = [ ] )
133+ pool = ActiveRecord ::Base . connection_pool
134+ ActiveRecord ::SchemaDumper . ignore_tables = ignore_tables
135+ ActiveRecord ::SchemaDumper . dump ( pool , io )
136+ io . string
137+ end
138+
139+ def db_pool
140+ ActiveRecord ::Base . connection_pool
141+ end
138142end
0 commit comments