@@ -12,11 +12,7 @@ class SchemaDumperTest < ActiveRecord::TestCase
12
12
end
13
13
14
14
def standard_dump
15
- @@standard_dump ||= perform_schema_dump
16
- end
17
-
18
- def perform_schema_dump
19
- dump_all_table_schema [ ]
15
+ @@standard_dump ||= dump_all_table_schema
20
16
end
21
17
22
18
def test_dump_schema_information_with_empty_versions
@@ -354,13 +350,13 @@ def test_schema_dump_includes_extensions
354
350
connection = ActiveRecord ::Base . connection
355
351
356
352
connection . stub ( :extensions , [ "hstore" ] ) do
357
- output = perform_schema_dump
353
+ output = dump_all_table_schema
358
354
assert_match "# These are extensions that must be enabled" , output
359
355
assert_match %r{enable_extension "hstore"} , output
360
356
end
361
357
362
358
connection . stub ( :extensions , [ ] ) do
363
- output = perform_schema_dump
359
+ output = dump_all_table_schema
364
360
assert_no_match "# These are extensions that must be enabled" , output
365
361
assert_no_match %r{enable_extension} , output
366
362
end
@@ -370,13 +366,13 @@ def test_schema_dump_includes_extensions_in_alphabetic_order
370
366
connection = ActiveRecord ::Base . connection
371
367
372
368
connection . stub ( :extensions , [ "hstore" , "uuid-ossp" , "xml2" ] ) do
373
- output = perform_schema_dump
369
+ output = dump_all_table_schema
374
370
enabled_extensions = output . scan ( %r{enable_extension "(.+)"} ) . flatten
375
371
assert_equal [ "hstore" , "uuid-ossp" , "xml2" ] , enabled_extensions
376
372
end
377
373
378
374
connection . stub ( :extensions , [ "uuid-ossp" , "xml2" , "hstore" ] ) do
379
- output = perform_schema_dump
375
+ output = dump_all_table_schema
380
376
enabled_extensions = output . scan ( %r{enable_extension "(.+)"} ) . flatten
381
377
assert_equal [ "hstore" , "uuid-ossp" , "xml2" ] , enabled_extensions
382
378
end
@@ -427,7 +423,7 @@ def test_do_not_dump_foreign_keys_when_bypassed_by_config
427
423
}
428
424
)
429
425
430
- output = perform_schema_dump
426
+ output = dump_all_table_schema
431
427
assert_no_match ( /^\s +add_foreign_key "fk_test_has_fk"[^\n ]+\n \s +add_foreign_key "lessons_students"/ , output )
432
428
ensure
433
429
ActiveRecord ::Base . establish_connection ( :arunit )
@@ -461,7 +457,7 @@ def test_schema_dump_with_table_name_prefix_and_suffix
461
457
migration = CreateDogMigration . new
462
458
migration . migrate ( :up )
463
459
464
- output = perform_schema_dump
460
+ output = dump_all_table_schema
465
461
assert_no_match %r{create_table "foo_.+_bar"} , output
466
462
assert_no_match %r{add_index "foo_.+_bar"} , output
467
463
assert_no_match %r{create_table "schema_migrations"} , output
@@ -486,7 +482,7 @@ def test_schema_dump_with_table_name_prefix_and_suffix_regexp_escape
486
482
migration = CreateDogMigration . new
487
483
migration . migrate ( :up )
488
484
489
- output = perform_schema_dump
485
+ output = dump_all_table_schema
490
486
assert_no_match %r{create_table "foo\$ .+\$ bar"} , output
491
487
assert_no_match %r{add_index "foo\$ .+\$ bar"} , output
492
488
assert_no_match %r{create_table "schema_migrations"} , output
@@ -554,7 +550,7 @@ def down
554
550
end
555
551
migration . migrate ( :up )
556
552
557
- output = perform_schema_dump
553
+ output = dump_all_table_schema
558
554
assert output . include? ( 't.datetime "this_should_remain_datetime"' )
559
555
assert output . include? ( 't.datetime "this_is_an_alias_of_datetime"' )
560
556
assert output . include? ( 't.datetime "without_time_zone"' )
@@ -583,7 +579,7 @@ def down
583
579
end
584
580
migration . migrate ( :up )
585
581
586
- output = perform_schema_dump
582
+ output = dump_all_table_schema
587
583
assert output . include? ( 't.datetime "this_should_remain_datetime"' )
588
584
assert output . include? ( 't.datetime "this_is_an_alias_of_datetime"' )
589
585
assert output . include? ( 't.timestamp "without_time_zone"' )
@@ -611,7 +607,7 @@ def down
611
607
end
612
608
migration . migrate ( :up )
613
609
614
- output = perform_schema_dump
610
+ output = dump_all_table_schema
615
611
assert output . include? ( 't.datetime "this_should_remain_datetime"' )
616
612
assert output . include? ( 't.datetime "this_is_an_alias_of_datetime"' )
617
613
assert output . include? ( 't.datetime "this_is_also_an_alias_of_datetime"' )
@@ -638,7 +634,7 @@ def down
638
634
end
639
635
migration . migrate ( :up )
640
636
641
- output = perform_schema_dump
637
+ output = dump_all_table_schema
642
638
# Normally we'd write `t.datetime` here. But because you've changed the `datetime_type`
643
639
# to something else, `t.datetime` now means `:timestamptz`. To ensure that old columns
644
640
# are still created as a `:timestamp` we need to change what is written to the schema dump.
@@ -672,15 +668,15 @@ def down
672
668
end
673
669
migration . migrate ( :up )
674
670
675
- output = perform_schema_dump
671
+ output = dump_all_table_schema
676
672
assert output . include? ( 't.datetime "default_format"' )
677
673
assert output . include? ( 't.datetime "without_time_zone"' )
678
674
assert output . include? ( 't.timestamptz "with_time_zone"' )
679
675
680
676
datetime_type_was = ActiveRecord ::ConnectionAdapters ::PostgreSQLAdapter . datetime_type
681
677
ActiveRecord ::ConnectionAdapters ::PostgreSQLAdapter . datetime_type = :timestamptz
682
678
683
- output = perform_schema_dump
679
+ output = dump_all_table_schema
684
680
assert output . include? ( 't.timestamp "default_format"' )
685
681
assert output . include? ( 't.timestamp "without_time_zone"' )
686
682
assert output . include? ( 't.datetime "with_time_zone"' )
@@ -708,7 +704,7 @@ def down
708
704
end
709
705
migration . migrate ( :up )
710
706
711
- output = perform_schema_dump
707
+ output = dump_all_table_schema
712
708
assert output . include? ( 't.datetime "default_format"' )
713
709
assert output . include? ( 't.datetime "without_time_zone"' )
714
710
assert output . include? ( 't.datetime "also_without_time_zone"' )
@@ -736,7 +732,7 @@ def down
736
732
end
737
733
migration . migrate ( :up )
738
734
739
- output = perform_schema_dump
735
+ output = dump_all_table_schema
740
736
assert output . include? ( 't.datetime "default_format"' )
741
737
assert output . include? ( 't.datetime "without_time_zone"' )
742
738
assert output . include? ( 't.datetime "also_without_time_zone"' )
@@ -763,7 +759,7 @@ def down
763
759
end
764
760
migration . migrate ( :up )
765
761
766
- output = perform_schema_dump
762
+ output = dump_all_table_schema
767
763
assert output . include? ( 't.datetime "default_format"' )
768
764
assert output . include? ( 't.datetime "without_time_zone"' )
769
765
assert output . include? ( 't.datetime "also_without_time_zone"' )
@@ -789,7 +785,7 @@ def down
789
785
end
790
786
migration . migrate ( :up )
791
787
792
- output = perform_schema_dump
788
+ output = dump_all_table_schema
793
789
# Normally we'd write `t.datetime` here. But because you've changed the `datetime_type`
794
790
# to something else, `t.datetime` now means `:timestamptz`. To ensure that old columns
795
791
# are still created as a `:timestamp` we need to change what is written to the schema dump.
@@ -822,7 +818,7 @@ def down
822
818
end
823
819
migration . migrate ( :up )
824
820
825
- output = perform_schema_dump
821
+ output = dump_all_table_schema
826
822
# Normally we'd write `t.datetime` here. But because you've changed the `datetime_type`
827
823
# to something else, `t.datetime` now means `:timestamptz`. To ensure that old columns
828
824
# are still created as a `:timestamp` we need to change what is written to the schema dump.
0 commit comments