Skip to content

Commit

Permalink
Suppress ActiveRecord logging
Browse files Browse the repository at this point in the history
  • Loading branch information
sambostock committed Nov 29, 2023
1 parent 349defa commit 4835a3a
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 4835a3a

Please sign in to comment.