diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 8f6faeb53..843b72670 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -88,6 +88,8 @@ class ApplicationController < ActionController::Base end def rescue_exception(exception) + return if Danbooru.config.debug_mode + case exception when ActionView::Template::Error rescue_exception(exception.cause) diff --git a/config/danbooru_default_config.rb b/config/danbooru_default_config.rb index 0bb6d3459..beed3096d 100644 --- a/config/danbooru_default_config.rb +++ b/config/danbooru_default_config.rb @@ -52,6 +52,15 @@ module Danbooru "_danbooru2_session" end + # Debug mode does some things to make testing easier. It disables parallel + # testing and it replaces Danbooru's custom exception page with the default + # Rails exception page. This is only useful during development and testing. + # + # Usage: `DANBOORU_DEBUG_MODE=true bin/rails test + def debug_mode + false + end + def source_code_url "https://github.com/danbooru/danbooru" end diff --git a/test/test_helper.rb b/test/test_helper.rb index 0959a8ccd..1af778120 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -30,11 +30,13 @@ class ActiveSupport::TestCase mock_post_version_service! mock_pool_version_service! - parallelize - parallelize_setup do |worker| - Rails.application.load_seed + unless Danbooru.config.debug_mode + parallelize + parallelize_setup do |worker| + Rails.application.load_seed - SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}" + SimpleCov.command_name "#{SimpleCov.command_name}-#{worker}" + end end parallelize_teardown do |worker|