Skip to content

Commit 49561bb

Browse files
authored
Merge pull request rails#54620 from zzak/re-54617
Ensure all railties tests require strict_warnings
2 parents f081b08 + 83b2c77 commit 49561bb

File tree

7 files changed

+3
-7
lines changed

7 files changed

+3
-7
lines changed

railties/Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ namespace :test do
116116
ARGV.clear.concat test_options
117117
Rake.application = nil
118118

119+
require "../tools/strict_warnings"
119120
load file
120121
}
121122
else

railties/test/abstract_unit.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative "../../tools/strict_warnings"
4-
53
ENV["RAILS_ENV"] ||= "test"
64

75
require "stringio"

railties/test/configuration/middleware_stack_proxy_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative "../../../tools/strict_warnings"
43
require "active_support"
54
require "active_support/testing/autorun"
65
require "rails/configuration"

railties/test/generators/argv_scrubber_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative "../../../tools/strict_warnings"
43
require "active_support/test_case"
54
require "active_support/testing/autorun"
65
require "rails/generators/rails/app/app_generator"

railties/test/generators/generator_test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# frozen_string_literal: true
22

3-
require_relative "../../../tools/strict_warnings"
43
require "active_support/test_case"
54
require "active_support/testing/autorun"
65
require "rails/generators/app_base"

railties/test/isolation/abstract_unit.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#
99
# It is also good to know what is the bare minimum to get
1010
# Rails booted up.
11-
require_relative "../../../tools/strict_warnings"
1211
require "fileutils"
1312
require "shellwords"
1413

tools/strict_warnings.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def warn(message, ...)
3030

3131
super
3232

33-
return unless message.include?(PROJECT_ROOT)
33+
testpath = message[/test\/.*\.rb/]&.chomp || message
34+
return unless message.include?(PROJECT_ROOT) || Pathname.new(testpath).exist?
3435
return if ALLOWED_WARNINGS.match?(message)
3536
return unless ENV["RAILS_STRICT_WARNINGS"] || ENV["BUILDKITE"]
3637

0 commit comments

Comments
 (0)