From 40d3bbee9935a59fe68020b2f03bef9540c2d7c3 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Sun, 30 Apr 2017 17:58:42 -0400 Subject: Friendly maintain schema failure --- railties/lib/rails/test_help.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'railties/lib/rails/test_help.rb') diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 0f9bf98737..81537d813e 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -12,7 +12,12 @@ require "rails/generators/test_case" require "active_support/testing/autorun" if defined?(ActiveRecord::Base) - ActiveRecord::Migration.maintain_test_schema! + begin + ActiveRecord::Migration.maintain_test_schema! + rescue ActiveRecord::PendingMigrationError => e + puts e.to_s.strip + exit 1 + end module ActiveSupport class TestCase -- cgit v1.2.3 From 618268b4b9382f4bcf004a945fe2d85c0bd03e32 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Fri, 30 Jun 2017 13:55:31 +0900 Subject: [Railties] require => require_relative --- railties/lib/rails/test_help.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'railties/lib/rails/test_help.rb') diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 81537d813e..05048eb2e1 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -2,12 +2,12 @@ # so fixtures aren't loaded into that environment abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production? -require "rails/test_unit/minitest_plugin" +require_relative "test_unit/minitest_plugin" require "active_support/test_case" require "action_controller" require "action_controller/test_case" require "action_dispatch/testing/integration" -require "rails/generators/test_case" +require_relative "generators/test_case" require "active_support/testing/autorun" -- cgit v1.2.3 From 0d72489b2a08487f71dd4230846c01a5d99ef35f Mon Sep 17 00:00:00 2001 From: Kasper Timm Hansen Date: Sun, 25 Jun 2017 19:08:26 +0200 Subject: * Don't eagerly require Rails' minitest plugin. By making the Rails minitest behave like a standard minitest plugin we're much more likely to not break when people use other minitest plugins. Like minitest-focus and pride. To do this, we need to behave like minitest: require files up front and then perform the plugin behavior via the at_exit hook. This also saves us a fair bit of wrangling with test file loading. Finally, since the environment and warnings options have to be applied as early as possible, and since minitest loads plugins at_exit, they have to be moved to the test command. * Don't expect the root method. It's likely this worked because we eagerly loaded the Rails minitest plugin and that somehow defined a root method on `Rails`. * Assign a backtrace to failed exceptions. Otherwise Minitest pukes when attempting to filter the backtrace (which Rails' backtrace cleaner then removes). Means the exception message test has to be revised too. This is likely caused by the rails minitest plugin now being loaded for these tests and assigning a default backtrace cleaner. --- railties/lib/rails/test_help.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'railties/lib/rails/test_help.rb') diff --git a/railties/lib/rails/test_help.rb b/railties/lib/rails/test_help.rb index 05048eb2e1..33b6740cf1 100644 --- a/railties/lib/rails/test_help.rb +++ b/railties/lib/rails/test_help.rb @@ -2,7 +2,6 @@ # so fixtures aren't loaded into that environment abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production? -require_relative "test_unit/minitest_plugin" require "active_support/test_case" require "action_controller" require "action_controller/test_case" -- cgit v1.2.3