Skip to content

Commit

Permalink
handle Rails deprecations in tests
Browse files Browse the repository at this point in the history
Dynamic :controller and :action segments have been deprecated. We replace them with a static list of routes that we use in tests.

Another deprecation is “`to_time` will always preserve the receiver timezone rather than system local time in Rails 8.1”. We don’t really care one way or another in this test app, so we opt in for the new behaviour.
  • Loading branch information
razumau committed Nov 19, 2024
1 parent 795ea24 commit 7938163
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

class TestApp < Rails::Application
config.active_support.deprecation = :stderr
config.active_support.to_time_preserves_timezone = :zone
config.active_support.test_order = :random if config.active_support.respond_to?(:test_order=)
config.eager_load = false
config.secret_key_base = "secret"
Expand All @@ -36,7 +37,12 @@ class TestEngine < Rails::Engine
mount TestEngine => ""
match "/test" => "test#test", :via => [:get, :put]
match "*path.:format" => "charcoal/cross_origin#preflight", :via => :options
get ":controller/:action"
get "test_controller/test_action", to: "test_controller#test_action"
get "test_cors/test_action", to: "test_cors#test_action"
get "test_cors/test", to: "test_cors#test"
get "test_cors/test_error_action", to: "test_cors#test_error_action"
get "jsonp_controller_tester/test", to: "jsonp_controller_tester#test"
get "charcoal/cross_origin/preflight", to: "charcoal/cross_origin#preflight"
end

class ActiveSupport::TestCase
Expand Down

0 comments on commit 7938163

Please sign in to comment.