diff options
Diffstat (limited to 'actionpack/test/dispatch/url_generation_test.rb')
-rw-r--r-- | actionpack/test/dispatch/url_generation_test.rb | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/actionpack/test/dispatch/url_generation_test.rb b/actionpack/test/dispatch/url_generation_test.rb index 8c9782bb90..aef9351de1 100644 --- a/actionpack/test/dispatch/url_generation_test.rb +++ b/actionpack/test/dispatch/url_generation_test.rb @@ -1,4 +1,6 @@ -require 'abstract_unit' +# frozen_string_literal: true + +require "abstract_unit" module TestUrlGeneration class WithMountPoint < ActionDispatch::IntegrationTest @@ -13,11 +15,11 @@ module TestUrlGeneration end Routes.draw do - get "/foo", :to => "my_route_generating#index", :as => :foo + get "/foo", to: "my_route_generating#index", as: :foo resources :bars - mount MyRouteGeneratingController.action(:index), at: '/bar' + mount MyRouteGeneratingController.action(:index), at: "/bar" end APP = build_app Routes @@ -35,22 +37,22 @@ module TestUrlGeneration end test "accepting a :script_name option" do - assert_equal "/bar/foo", foo_path(:script_name => "/bar") + assert_equal "/bar/foo", foo_path(script_name: "/bar") end test "the request's SCRIPT_NAME takes precedence over the route" do - get "/foo", headers: { 'SCRIPT_NAME' => "/new", 'action_dispatch.routes' => Routes } + get "/foo", headers: { "SCRIPT_NAME" => "/new", "action_dispatch.routes" => Routes } assert_equal "/new/foo", response.body end test "the request's SCRIPT_NAME wraps the mounted app's" do - get '/new/bar/foo', headers: { 'SCRIPT_NAME' => '/new', 'PATH_INFO' => '/bar/foo', 'action_dispatch.routes' => Routes } + get "/new/bar/foo", headers: { "SCRIPT_NAME" => "/new", "PATH_INFO" => "/bar/foo", "action_dispatch.routes" => Routes } assert_equal "/new/bar/foo", response.body end test "handling http protocol with https set" do https! - assert_equal "http://www.example.com/foo", foo_url(:protocol => "http") + assert_equal "http://www.example.com/foo", foo_url(protocol: "http") end test "extracting protocol from host when protocol not present" do @@ -117,25 +119,23 @@ module TestUrlGeneration test "generating URLs with trailing slashes" do assert_equal "/bars.json", bars_path( trailing_slash: true, - format: 'json' + format: "json" ) end test "generating URLS with querystring and trailing slashes" do assert_equal "/bars.json?a=b", bars_path( trailing_slash: true, - a: 'b', - format: 'json' + a: "b", + format: "json" ) end test "generating URLS with empty querystring" do assert_equal "/bars.json", bars_path( a: {}, - format: 'json' + format: "json" ) end - end end - |