Skip to content

Commit 40b9cb0

Browse files
committed
Fix broken tests for older Rails versions
doorkeeper-gem#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.
1 parent a02cd99 commit 40b9cb0

File tree

1 file changed

+4
-1
lines changed
  • spec/dummy/config/environments

1 file changed

+4
-1
lines changed

spec/dummy/config/environments/test.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
config.action_controller.perform_caching = false
2424

2525
# Raise exceptions instead of rendering exception templates
26-
config.action_dispatch.show_exceptions = :none
26+
# Rails 7.1 deprecated false in favor of :none, but we need to use false for
27+
# backwards compatibility: https://github.com/rails/rails/pull/45867
28+
config.action_dispatch.show_exceptions =
29+
Gem::Version.new(Rails.version) >= Gem::Version.new('7.1.0') ? :none : false
2730

2831
# Disable request forgery protection in test environment
2932
config.action_controller.allow_forgery_protection = false

0 commit comments

Comments
 (0)