File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -644,9 +644,7 @@ def nearest_delegate # :nodoc:
644
644
645
645
# Raises <tt>ActiveRecord::PendingMigrationError</tt> error if any migrations are pending.
646
646
def check_pending! ( connection = ActiveRecord ::Tasks ::DatabaseTasks . migration_connection )
647
- if pending_migrations = connection . migration_context . pending_migrations
648
- raise ActiveRecord ::PendingMigrationError . new ( pending_migrations : pending_migrations )
649
- end
647
+ raise ActiveRecord ::PendingMigrationError if connection . migration_context . needs_migration?
650
648
end
651
649
652
650
def load_schema_if_pending!
Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ def test_with_stdlib_logger
89
89
private
90
90
def assert_pending_migrations ( *expected_migrations )
91
91
2 . times do
92
+ assert_raises ActiveRecord ::PendingMigrationError do
93
+ ActiveRecord ::Migration . check_pending!
94
+ end
95
+
92
96
error = assert_raises ActiveRecord ::PendingMigrationError do
93
97
CheckPending . new ( proc { flunk } ) . call ( { } )
94
98
end
@@ -105,6 +109,10 @@ def assert_no_pending_migrations
105
109
check_pending = CheckPending . new ( app )
106
110
107
111
2 . times do
112
+ assert_nothing_raised do
113
+ ActiveRecord ::Migration . check_pending!
114
+ end
115
+
108
116
app . expect :call , nil , [ { } ]
109
117
check_pending . call ( { } )
110
118
app . verify
You can’t perform that action at this time.
0 commit comments