Skip to content

Commit

Permalink
silence all warnings in CI runs via env
Browse files Browse the repository at this point in the history
  • Loading branch information
rococodogs committed Aug 27, 2024
1 parent 0791f8d commit e12cb16
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 1 addition & 4 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test

# Silence deprecations via ENV
config.active_support.deprecation = begin
ActiveModel::Type::Boolean.new.cast(ENV.fetch('RAILS_SILENCE_DEPRECATIONS', false)) ? :silence : :stderr
end
config.active_support.deprecation = :stderr

config.active_job.queue_adapter = :test
end
12 changes: 12 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@
if ENV['CI']
require 'rspec/github'
config.add_formatter RSpec::Github::Formatter

# @see https://stackoverflow.com/a/52213501
if ActiveModel::Type::Boolean.new.cast(ENV.fetch('RAILS_SILENCE_DEPRECATIONS', false))
config.before(:all) do
@with_warnings = $VERBOSE
$VERBOSE = nil
end

config.after(:all) do
$VERBOSE = @with_warnings
end
end
end

config.expect_with :rspec do |expectations|
Expand Down

0 comments on commit e12cb16

Please sign in to comment.