From 5ad7f8ab418f0c760dbb584f7c78d94ce32e9ee3 Mon Sep 17 00:00:00 2001 From: Robin Dupret Date: Sun, 14 Oct 2012 12:03:39 +0200 Subject: Use Ruby 1.9 Hash syntax in railties --- railties/test/application/configuration_test.rb | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'railties/test/application/configuration_test.rb') diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 3691c5e3d5..7a120410ba 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -239,7 +239,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index cookies.signed[:some_key] = "some_value" - render :text => env["action_dispatch.secret_token"] + render text: env["action_dispatch.secret_token"] end end @@ -252,7 +252,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :inline => "<%= csrf_meta_tags %>" + render inline: "<%= csrf_meta_tags %>" end end @@ -272,11 +272,11 @@ module ApplicationTests app_file 'app/controllers/posts_controller.rb', <<-RUBY class PostsController < ApplicationController def show - render :inline => "<%= begin; form_for(Post.new) {}; rescue => e; e.to_s; end %>" + render inline: "<%= begin; form_for(Post.new) {}; rescue => e; e.to_s; end %>" end def update - render :text => "update" + render text: "update" end end RUBY @@ -291,7 +291,7 @@ module ApplicationTests token = "cf50faa3fe97702ca1ae" PostsController.any_instance.stubs(:form_authenticity_token).returns(token) - params = {:authenticity_token => token} + params = {authenticity_token: token} get "/posts/1" assert_match(/patch/, last_response.body) @@ -316,7 +316,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :inline => "<%= csrf_meta_tags %>" + render inline: "<%= csrf_meta_tags %>" end end @@ -440,7 +440,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :inline => "<%= image_path('foo.jpg') %>" + render inline: "<%= image_path('foo.jpg') %>" end end @@ -493,7 +493,7 @@ module ApplicationTests class ::OmgController < ActionController::Base def index - render :text => env["action_dispatch.show_exceptions"] + render text: env["action_dispatch.show_exceptions"] end end @@ -503,7 +503,7 @@ module ApplicationTests test "config.action_controller.wrap_parameters is set in ActionController::Base" do app_file 'config/initializers/wrap_parameters.rb', <<-RUBY - ActionController::Base.wrap_parameters :format => [:json] + ActionController::Base.wrap_parameters format: [:json] RUBY app_file 'app/models/post.rb', <<-RUBY @@ -523,7 +523,7 @@ module ApplicationTests app_file 'app/controllers/posts_controller.rb', <<-RUBY class PostsController < ApplicationController def create - render :text => params[:post].inspect + render text: params[:post].inspect end end RUBY @@ -544,7 +544,7 @@ module ApplicationTests app_file 'app/controllers/posts_controller.rb', <<-RUBY class PostsController < ActionController::Base def create - render :text => params[:post].permitted? ? "permitted" : "forbidden" + render text: params[:post].permitted? ? "permitted" : "forbidden" end end RUBY @@ -558,7 +558,7 @@ module ApplicationTests require "#{app_path}/config/environment" - post "/posts", {:post => {"title" =>"zomg"}} + post "/posts", {post: {"title" =>"zomg"}} assert_equal 'permitted', last_response.body end @@ -570,8 +570,8 @@ module ApplicationTests class ::OmgController < ActionController::Base def index respond_to do |format| - format.html { render :text => "HTML" } - format.xml { render :text => "XML" } + format.html { render text: "HTML" } + format.xml { render text: "XML" } end end end @@ -579,7 +579,7 @@ module ApplicationTests get "/", {}, "HTTP_ACCEPT" => "application/xml" assert_equal 'HTML', last_response.body - get "/", { :format => :xml }, "HTTP_ACCEPT" => "application/xml" + get "/", { format: :xml }, "HTTP_ACCEPT" => "application/xml" assert_equal 'XML', last_response.body end -- cgit v1.2.3