From 5b6eb1d58b48fada298215b2cccda89f993890c3 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 6 Aug 2016 19:35:13 +0200 Subject: modernizes hash syntax in actionpack --- actionpack/test/controller/render_json_test.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'actionpack/test/controller/render_json_test.rb') diff --git a/actionpack/test/controller/render_json_test.rb b/actionpack/test/controller/render_json_test.rb index 07839ce91f..69fbf59905 100644 --- a/actionpack/test/controller/render_json_test.rb +++ b/actionpack/test/controller/render_json_test.rb @@ -6,13 +6,13 @@ require "pathname" class RenderJsonTest < ActionController::TestCase class JsonRenderable def as_json(options={}) - hash = { :a => :b, :c => :d, :e => :f } + hash = { a: :b, c: :d, e: :f } hash.except!(*options[:except]) if options[:except] hash end def to_json(options = {}) - super :except => [:c, :e] + super except: [:c, :e] end end @@ -24,7 +24,7 @@ class RenderJsonTest < ActionController::TestCase end def render_json_nil - render :json => nil + render json: nil end def render_json_render_to_string @@ -32,35 +32,35 @@ class RenderJsonTest < ActionController::TestCase end def render_json_hello_world - render :json => ActiveSupport::JSON.encode(:hello => "world") + render json: ActiveSupport::JSON.encode(hello: "world") end def render_json_hello_world_with_status - render :json => ActiveSupport::JSON.encode(:hello => "world"), :status => 401 + render json: ActiveSupport::JSON.encode(hello: "world"), status: 401 end def render_json_hello_world_with_callback - render :json => ActiveSupport::JSON.encode(:hello => "world"), :callback => "alert" + render json: ActiveSupport::JSON.encode(hello: "world"), callback: "alert" end def render_json_with_custom_content_type - render :json => ActiveSupport::JSON.encode(:hello => "world"), :content_type => "text/javascript" + render json: ActiveSupport::JSON.encode(hello: "world"), content_type: "text/javascript" end def render_symbol_json - render :json => ActiveSupport::JSON.encode(:hello => "world") + render json: ActiveSupport::JSON.encode(hello: "world") end def render_json_with_render_to_string - render :json => {:hello => render_to_string(:partial => "partial")} + render json: {hello: render_to_string(partial: "partial")} end def render_json_with_extra_options - render :json => JsonRenderable.new, :except => [:c, :e] + render json: JsonRenderable.new, except: [:c, :e] end def render_json_without_options - render :json => JsonRenderable.new + render json: JsonRenderable.new end end -- cgit v1.2.3