Skip to content

Commit 40b7a7c

Browse files
committed
try this warning suppression approach
1 parent 8d5a4e9 commit 40b7a7c

3 files changed

Lines changed: 2 additions & 2 deletions

File tree

lib/view_component/template.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def initialize(component:, details:, path:)
2424
# If the template file has no format (e.g. .erb instead of .html.erb),
2525
# assume the default format (html).
2626
if details.format.nil?
27-
Kernel.warn("Template format for #{path} is missing, defaulting to :html.")
27+
Kernel.warn("WARNING: Template format for #{path} is missing, defaulting to :html.")
2828
details = ActionView::TemplateDetails.new(details.locale, details.handler, DEFAULT_FORMAT, details.variant)
2929
end
3030

test/sandbox/config/environments/test.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
end
1010

1111
Warning.ignore(/warning: parser\/current/)
12-
Warning.ignore(/(format_less_parent|format_less_child|no_format)_component.erb is missing, defaulting to :html/)
1312

1413
Sandbox::Application.configure do
1514
# Settings specified here will take precedence over those in config/application.rb

test/test_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ module Warning
1414
def self.warn(message)
1515
called_by = caller_locations(1, 1).first.path
1616
return super unless called_by&.start_with?(PROJECT_ROOT) && !called_by.start_with?("#{PROJECT_ROOT}/vendor")
17+
return super if message.include?("Template format for")
1718

1819
raise "Warning: #{message}"
1920
end

0 commit comments

Comments
 (0)