Skip to content

Commit

Permalink
Abort on warnings again
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Apr 10, 2023
1 parent 7cac78e commit d860be8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions test/support/no_warnings_policy.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# frozen_string_literal: true

module NoWarningsPolicy
IGNORE = "Zeitwerk defines the constant"
MESSAGE = "This test suite aborts on warnings, please fix the one above."

if Warning.method(:warn).arity == 1
def warn(*)
def warn(msg)
super
abort(MESSAGE)
abort(MESSAGE) unless msg.include?(IGNORE)
end
else
def warn(*, **)
def warn(msg, **)
super
abort(MESSAGE)
abort(MESSAGE) unless msg.include?(IGNORE)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require "minitest/reporters"
Minitest::Reporters.use!(Minitest::Reporters::DefaultReporter.new)

# require_relative "support/no_warnings_policy"
require_relative "support/no_warnings_policy"
require_relative "support/test_macro"
require_relative "support/delete_loaded_feature"
require_relative "support/loader_test"
Expand Down

0 comments on commit d860be8

Please sign in to comment.