@@ -126,18 +126,37 @@ def test_exception_includes_backtrace_when_enabled
126126 JSONAPI . configuration . include_backtraces_in_errors = true
127127 assert_cacheable_get :index
128128 assert_response 500
129- assert_includes @response . body , "backtrace" , "expected backtrace in error body"
129+ assert_includes @response . body , ' "backtrace"' , "expected backtrace in error body"
130130
131131 JSONAPI . configuration . include_backtraces_in_errors = false
132132 assert_cacheable_get :index
133133 assert_response 500
134- refute_includes @response . body , "backtrace" , "expected backtrace in error body"
134+ refute_includes @response . body , ' "backtrace"' , "expected backtrace in error body"
135135
136136 ensure
137137 $PostProcessorRaisesErrors = false
138138 JSONAPI . configuration . include_backtraces_in_errors = original_config
139139 end
140140
141+ def test_exception_includes_application_backtrace_when_enabled
142+ original_config = JSONAPI . configuration . include_application_backtraces_in_errors
143+ $PostProcessorRaisesErrors = true
144+
145+ JSONAPI . configuration . include_application_backtraces_in_errors = true
146+ assert_cacheable_get :index
147+ assert_response 500
148+ assert_includes @response . body , '"application_backtrace"' , "expected application backtrace in error body"
149+
150+ JSONAPI . configuration . include_application_backtraces_in_errors = false
151+ assert_cacheable_get :index
152+ assert_response 500
153+ refute_includes @response . body , '"application_backtrace"' , "expected application backtrace in error body"
154+
155+ ensure
156+ $PostProcessorRaisesErrors = false
157+ JSONAPI . configuration . include_application_backtraces_in_errors = original_config
158+ end
159+
141160 def test_on_server_error_block_callback_with_exception
142161 original_config = JSONAPI . configuration . dup
143162 JSONAPI . configuration . exception_class_whitelist = [ ]
0 commit comments