From 40b9cb08815e41a2802670e11bb0772a584b50ba Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 24 Oct 2024 09:33:53 -0700 Subject: [PATCH] Fix broken tests for older Rails versions https://github.com/doorkeeper-gem/doorkeeper/pull/1736 broke tests for Rails < 7.1 because these versions compared `config.action_dispatch.show_exceptions == false`. Conditionally set this value in the test set up to fix the broken tests. --- spec/dummy/config/environments/test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index 240b92ec6..e6c2c78a3 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -23,7 +23,10 @@ config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates - config.action_dispatch.show_exceptions = :none + # Rails 7.1 deprecated false in favor of :none, but we need to use false for + # backwards compatibility: https://github.com/rails/rails/pull/45867 + config.action_dispatch.show_exceptions = + Gem::Version.new(Rails.version) >= Gem::Version.new('7.1.0') ? :none : false # Disable request forgery protection in test environment config.action_controller.allow_forgery_protection = false