From 4835a3a37e0c8356ea33fa6aa07f2e1faf9936b5 Mon Sep 17 00:00:00 2001 From: Sam Bostock Date: Tue, 21 Nov 2023 04:08:55 -0500 Subject: [PATCH] Suppress `ActiveRecord` logging --- test/test_helper.rb | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/test/test_helper.rb b/test/test_helper.rb index 64032ea8..3e4023fd 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -64,25 +64,27 @@ class Order < ActiveRecord::Base config.redis = { host: redis_host } end -ActiveRecord::Schema.define do - create_table(:products, force: true) do |t| - t.string(:name) - t.timestamps - end +ActiveRecord::Migration.suppress_messages do + ActiveRecord::Schema.define do + create_table(:products, force: true) do |t| + t.string(:name) + t.timestamps + end - create_table(:comments, force: true) do |t| - t.string(:content) - t.belongs_to(:product) - end + create_table(:comments, force: true) do |t| + t.string(:content) + t.belongs_to(:product) + end - create_table(:travel_routes, force: true, primary_key: [:origin, :destination]) do |t| - t.string(:destination) - t.string(:origin) - end + create_table(:travel_routes, force: true, primary_key: [:origin, :destination]) do |t| + t.string(:destination) + t.string(:origin) + end - create_table(:orders, force: true) do |t| - t.integer(:shop_id) - t.string(:name) + create_table(:orders, force: true) do |t| + t.integer(:shop_id) + t.string(:name) + end end end @@ -104,6 +106,7 @@ def assert_logged(message) end JobIteration.logger = Logger.new(IO::NULL) +ActiveJob::Base.logger = Logger.new(IO::NULL) module ActiveSupport class TestCase