From ed15755286e4daeaffb01c5bd079a46b31f5a726 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Sat, 2 May 2020 00:22:13 +0900 Subject: [PATCH] Suppress `warning: already initialized constant` This PR suppresses the following `warning: already initialized constant`. ```console % path/to/oracle-enhanced % bundle exec rake (snip) ==> Loading config from ENV or use default ==> Running specs with MRI version 2.7.1 ==> Effective ActiveRecord version 6.1.0.alpha /home/vagrant/src/oracle-enhanced/spec/spec_helper.rb:113: warning: already initialized constant ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES /home/vagrant/.rvm/gems/ruby-2.7.1/bundler/gems/rails-348e142b26b4/activerecord/lib/active_record/log_subscriber.rb:5: warning: previous definition of IGNORE_PAYLOAD_NAMES was here ``` --- spec/spec_helper.rb | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6b154cc13..3504ffb03 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -105,14 +105,7 @@ def wait end end -# TODO: Address these warnings: -# /path/to/spec/spec_helper.rb:112: warning: already initialized constant ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES -# /path/to/rails/activerecord/lib/active_record/log_subscriber.rb:5: warning: previous definition of IGNORE_PAYLOAD_NAMES was here -module ActiveRecord - class LogSubscriber - IGNORE_PAYLOAD_NAMES = ["EXPLAIN"] - end -end +ActiveRecord::LogSubscriber::IGNORE_PAYLOAD_NAMES.replace(["EXPLAIN"]) module SchemaSpecHelper def schema_define(&block)