diff options
Diffstat (limited to 'actionpack/test/controller/action_pack_assertions_test.rb')
-rw-r--r-- | actionpack/test/controller/action_pack_assertions_test.rb | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/actionpack/test/controller/action_pack_assertions_test.rb b/actionpack/test/controller/action_pack_assertions_test.rb index 7b7f3d1de6..ab3db80119 100644 --- a/actionpack/test/controller/action_pack_assertions_test.rb +++ b/actionpack/test/controller/action_pack_assertions_test.rb @@ -5,25 +5,25 @@ class ActionPackAssertionsController < ActionController::Base def nothing() head :ok end - def hello_xml_world() render :template => "test/hello_xml_world"; end + def hello_xml_world() render template: "test/hello_xml_world"; end def hello_xml_world_pdf self.content_type = "application/pdf" - render :template => "test/hello_xml_world" + render template: "test/hello_xml_world" end def hello_xml_world_pdf_header response.headers["Content-Type"] = "application/pdf; charset=utf-8" - render :template => "test/hello_xml_world" + render template: "test/hello_xml_world" end def redirect_internal() redirect_to "/nothing"; end - def redirect_to_action() redirect_to :action => "flash_me", :id => 1, :params => { "panda" => "fun" }; end + def redirect_to_action() redirect_to action: "flash_me", id: 1, params: { "panda" => "fun" }; end - def redirect_to_controller() redirect_to :controller => "elsewhere", :action => "flash_me"; end + def redirect_to_controller() redirect_to controller: "elsewhere", action: "flash_me"; end - def redirect_to_controller_with_symbol() redirect_to :controller => :elsewhere, :action => :flash_me; end + def redirect_to_controller_with_symbol() redirect_to controller: :elsewhere, action: :flash_me; end def redirect_to_path() redirect_to "/some/path" end @@ -53,7 +53,7 @@ class ActionPackAssertionsController < ActionController::Base def assign_this @howdy = "ho" - render :inline => "Mr. Henke" + render inline: "Mr. Henke" end def render_based_on_parameters @@ -84,11 +84,11 @@ class ActionPackAssertionsController < ActionController::Base end def render_file_absolute_path - render :file => File.expand_path("../../../README.rdoc", __FILE__) + render file: File.expand_path("../../../README.rdoc", __FILE__) end def render_file_relative_path - render :file => "README.rdoc" + render file: "README.rdoc" end end @@ -116,15 +116,15 @@ module Admin end def redirect_to_absolute_controller - redirect_to :controller => "/content" + redirect_to controller: "/content" end def redirect_to_fellow_controller - redirect_to :controller => "user" + redirect_to controller: "user" end def redirect_to_top_level_named_route - redirect_to top_level_url(:id => "foo") + redirect_to top_level_url(id: "foo") end end end @@ -167,7 +167,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase def test_string_constraint with_routing do |set| set.draw do - get "photos", :to => "action_pack_assertions#nothing", :constraints => {:subdomain => "admin"} + get "photos", to: "action_pack_assertions#nothing", constraints: {subdomain: "admin"} end end end @@ -175,8 +175,8 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase def test_assert_redirect_to_named_route_failure with_routing do |set| set.draw do - get "route_one", :to => "action_pack_assertions#nothing", :as => :route_one - get "route_two", :to => "action_pack_assertions#nothing", :id => "two", :as => :route_two + get "route_one", to: "action_pack_assertions#nothing", as: :route_one + get "route_two", to: "action_pack_assertions#nothing", id: "two", as: :route_two ActiveSupport::Deprecation.silence do get ":controller/:action" @@ -190,7 +190,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase assert_redirected_to %r(^http://test.host/route_two) end assert_raise(ActiveSupport::TestCase::Assertion) do - assert_redirected_to :controller => "action_pack_assertions", :action => "nothing", :id => "two" + assert_redirected_to controller: "action_pack_assertions", action: "nothing", id: "two" end assert_raise(ActiveSupport::TestCase::Assertion) do assert_redirected_to route_two_url @@ -203,7 +203,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase with_routing do |set| set.draw do - get "admin/inner_module", :to => "admin/inner_module#index", :as => :admin_inner_module + get "admin/inner_module", to: "admin/inner_module#index", as: :admin_inner_module ActiveSupport::Deprecation.silence do get ":controller/:action" @@ -220,7 +220,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase with_routing do |set| set.draw do - get "/action_pack_assertions/:id", :to => "action_pack_assertions#index", :as => :top_level + get "/action_pack_assertions/:id", to: "action_pack_assertions#index", as: :top_level ActiveSupport::Deprecation.silence do get ":controller/:action" @@ -239,7 +239,7 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase with_routing do |set| set.draw do # this controller exists in the admin namespace as well which is the only difference from previous test - get "/user/:id", :to => "user#index", :as => :top_level + get "/user/:id", to: "user#index", as: :top_level ActiveSupport::Deprecation.silence do get ":controller/:action" @@ -376,13 +376,13 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase def test_assert_redirection_fails_with_incorrect_controller process :redirect_to_controller assert_raise(ActiveSupport::TestCase::Assertion) do - assert_redirected_to :controller => "action_pack_assertions", :action => "flash_me" + assert_redirected_to controller: "action_pack_assertions", action: "flash_me" end end def test_assert_redirection_with_extra_controller_option get :redirect_to_action - assert_redirected_to :controller => "action_pack_assertions", :action => "flash_me", :id => 1, :params => { :panda => "fun" } + assert_redirected_to controller: "action_pack_assertions", action: "flash_me", id: 1, params: { panda: "fun" } end def test_redirected_to_url_leading_slash @@ -410,21 +410,21 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase def test_assert_redirection_with_symbol process :redirect_to_controller_with_symbol assert_nothing_raised { - assert_redirected_to :controller => "elsewhere", :action => "flash_me" + assert_redirected_to controller: "elsewhere", action: "flash_me" } process :redirect_to_controller_with_symbol assert_nothing_raised { - assert_redirected_to :controller => :elsewhere, :action => :flash_me + assert_redirected_to controller: :elsewhere, action: :flash_me } end def test_redirected_to_with_nested_controller @controller = Admin::InnerModuleController.new get :redirect_to_absolute_controller - assert_redirected_to :controller => "/content" + assert_redirected_to controller: "/content" get :redirect_to_fellow_controller - assert_redirected_to :controller => "admin/user" + assert_redirected_to controller: "admin/user" end def test_assert_response_uses_exception_message |