lib/scrivito/test_request.rb in scrivito_sdk-0.42.1 vs lib/scrivito/test_request.rb in scrivito_sdk-0.50.0.rc1

- old
+ new

@@ -1,10 +1,16 @@ module Scrivito # # @api public # module TestRequest + ROUTING_ERRORS = [ + AbstractController::ActionNotFound, + ActionController::RoutingError, + ActionController::UrlGenerationError, + ] + # # Make a test request to act as a CMS request. # This is necessary for testing controllers that include {Scrivito::ControllerActions}, because # these controllers do not have explicit routes by default. # @@ -19,19 +25,18 @@ # assert_response :success # end # end # def for_scrivito_obj(test_obj = nil) - # prepare the env as if the given obj was loaded by Scrivito::CmsEnv env[Scrivito::CmsEnv::OBJ_ENV_KEY] = test_obj if test_obj class << self def assign_parameters(routes, controller_path, action, parameters = {}) - super(routes, controller_path, action, parameters) - rescue ActionController::RoutingError, AbstractController::ActionNotFound => e + super routes, controller_path, action, parameters + rescue *ROUTING_ERRORS => e begin - super(routes, "scrivito/cms_dispatch", action, parameters) - rescue ActionController::RoutingError, AbstractController::ActionNotFound + super routes, 'scrivito/cms_dispatch', action, parameters + rescue *ROUTING_ERRORS raise e end end end end