From b37b90251f2ff20cd6cb90d6351b86dc8e09643f Mon Sep 17 00:00:00 2001 From: Ashik Salman Date: Tue, 4 May 2021 19:55:41 +0530 Subject: [PATCH] Return an empty array if annotated_source_code is nil. --- .../test/dispatch/debug_exceptions_test.rb | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb index 9878adbfa2..ca256c5f82 100644 --- a/actionpack/test/dispatch/debug_exceptions_test.rb +++ b/actionpack/test/dispatch/debug_exceptions_test.rb @@ -26,12 +26,6 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest class Boomer attr_accessor :closed - class NilAnnotedSourceCodeError < StandardError - def annoted_source_code - nil - end - end - def initialize(detailed = false) @detailed = detailed @closed = false @@ -60,10 +54,6 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest end end - def method_that_raises_nil_annoted_source_code - raise NilAnnotedSourceCodeError, "nil annoted_source_code" - end - def call(env) env["action_dispatch.show_detailed_exceptions"] = @detailed req = ActionDispatch::Request.new(env) @@ -123,8 +113,6 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest raise_nested_exceptions when %r{/actionable_error} raise CustomActionableError - when %r{/nil_annoted_source_code_error} - method_that_raises_nil_annoted_source_code when "/utf8_template_error" begin eval "“fancy string”" @@ -744,20 +732,6 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest assert_match "ActionController::BadRequest", body end - test "debug exceptions with misbehaving Exception#annoted_source_code" do - @app = DevelopmentApp - - io = StringIO.new - logger = ActiveSupport::Logger.new(io) - - get "/nil_annoted_source_code_error", headers: { "action_dispatch.show_exceptions" => true, "action_dispatch.logger" => logger } - - assert_select "header h1", /DebugExceptionsTest::Boomer::NilAnnotedSourceCodeError/ - assert_select "#container div.exception-message" do - assert_select "div", /nil annoted_source_code/ - end - end - test "debug exceptions app shows diagnostics for template errors that contain UTF-8 characters" do @app = DevelopmentApp