Skip to content

Commit

Permalink
Fix broken tests for older Rails versions
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
stanhu committed Oct 24, 2024
1 parent a02cd99 commit 40b9cb0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spec/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40b9cb0

Please sign in to comment.