@@ -87,7 +87,6 @@ def test_migration_version_matches_component_version
87
87
88
88
def test_migrator_versions
89
89
migrations_path = MIGRATIONS_ROOT + "/valid"
90
- old_path = ActiveRecord ::Migrator . migrations_paths
91
90
migrator = ActiveRecord ::MigrationContext . new ( migrations_path )
92
91
93
92
migrator . up
@@ -100,33 +99,25 @@ def test_migrator_versions
100
99
101
100
ActiveRecord ::SchemaMigration . create! ( version : 3 )
102
101
assert_equal true , migrator . needs_migration?
103
- ensure
104
- ActiveRecord ::MigrationContext . new ( old_path )
105
102
end
106
103
107
104
def test_migration_detection_without_schema_migration_table
108
105
ActiveRecord ::Base . connection . drop_table "schema_migrations" , if_exists : true
109
106
110
107
migrations_path = MIGRATIONS_ROOT + "/valid"
111
- old_path = ActiveRecord ::Migrator . migrations_paths
112
108
migrator = ActiveRecord ::MigrationContext . new ( migrations_path )
113
109
114
110
assert_equal true , migrator . needs_migration?
115
- ensure
116
- ActiveRecord ::MigrationContext . new ( old_path )
117
111
end
118
112
119
113
def test_any_migrations
120
- old_path = ActiveRecord ::Migrator . migrations_paths
121
114
migrator = ActiveRecord ::MigrationContext . new ( MIGRATIONS_ROOT + "/valid" )
122
115
123
116
assert_predicate migrator , :any_migrations?
124
117
125
118
migrator_empty = ActiveRecord ::MigrationContext . new ( MIGRATIONS_ROOT + "/empty" )
126
119
127
120
assert_not_predicate migrator_empty , :any_migrations?
128
- ensure
129
- ActiveRecord ::MigrationContext . new ( old_path )
130
121
end
131
122
132
123
def test_migration_version
@@ -393,7 +384,6 @@ def test_internal_metadata_table_name
393
384
def test_internal_metadata_stores_environment
394
385
current_env = ActiveRecord ::ConnectionHandling ::DEFAULT_ENV . call
395
386
migrations_path = MIGRATIONS_ROOT + "/valid"
396
- old_path = ActiveRecord ::Migrator . migrations_paths
397
387
migrator = ActiveRecord ::MigrationContext . new ( migrations_path )
398
388
399
389
migrator . up
@@ -410,7 +400,6 @@ def test_internal_metadata_stores_environment
410
400
migrator . up
411
401
assert_equal new_env , ActiveRecord ::InternalMetadata [ :environment ]
412
402
ensure
413
- migrator = ActiveRecord ::MigrationContext . new ( old_path )
414
403
ENV [ "RAILS_ENV" ] = original_rails_env
415
404
ENV [ "RACK_ENV" ] = original_rack_env
416
405
migrator . up
@@ -422,16 +411,12 @@ def test_internal_metadata_stores_environment_when_other_data_exists
422
411
423
412
current_env = ActiveRecord ::ConnectionHandling ::DEFAULT_ENV . call
424
413
migrations_path = MIGRATIONS_ROOT + "/valid"
425
- old_path = ActiveRecord ::Migrator . migrations_paths
426
414
427
415
current_env = ActiveRecord ::ConnectionHandling ::DEFAULT_ENV . call
428
416
migrator = ActiveRecord ::MigrationContext . new ( migrations_path )
429
417
migrator . up
430
418
assert_equal current_env , ActiveRecord ::InternalMetadata [ :environment ]
431
419
assert_equal "bar" , ActiveRecord ::InternalMetadata [ :foo ]
432
- ensure
433
- migrator = ActiveRecord ::MigrationContext . new ( old_path )
434
- migrator . up
435
420
end
436
421
437
422
def test_proper_table_name_on_migration
0 commit comments