From c20e077b6542d3c4ea83fc918a16fe985f4dfd1b Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 29 Nov 2018 15:32:24 +0200 Subject: [PATCH 1/2] Set `config.active_support.deprecation` to :stderr in test env Otherwise calling `ActiveSupport::Deprecation.warn` leads to failing tests --- config/environments/test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/test.rb b/config/environments/test.rb index 544370369..119f6d815 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -16,7 +16,7 @@ Rails.application.configure do config.action_mailer.delivery_method = :test config.active_support.test_order = :random - config.active_support.deprecation = :raise + config.active_support.deprecation = :stderr config.logger = ActiveSupport::Logger.new(nil) config.action_view.raise_on_missing_translations = true From a09a6820fdf855ab64b0a5bbc26b46ab54b27e75 Mon Sep 17 00:00:00 2001 From: Artur Beljajev Date: Thu, 29 Nov 2018 15:32:53 +0200 Subject: [PATCH 2/2] Deprecate `TaskTestCase` class --- test/support/task_test_case.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/support/task_test_case.rb b/test/support/task_test_case.rb index 2b27f80a9..8c539a90a 100644 --- a/test/support/task_test_case.rb +++ b/test/support/task_test_case.rb @@ -4,9 +4,11 @@ class TaskTestCase < ActiveSupport::TestCase # This suppresses default stdout and makes Rails.env.test? checks unnecessary. @original_stdout = $stdout $stdout = File.open(File::NULL, 'w') + ActiveSupport::Deprecation.warn('`TaskTestCase` class will be removed soon.' \ + ' Use `capture_io` and `assert_output` instead') end teardown do $stdout = @original_stdout end -end \ No newline at end of file +end