aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/render_json_test.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2016-08-06 19:35:13 +0200
committerXavier Noria <fxn@hashref.com>2016-08-06 19:35:13 +0200
commit5b6eb1d58b48fada298215b2cccda89f993890c3 (patch)
treea48010fd8c35588540f50df257a76347091aca12 /actionpack/test/controller/render_json_test.rb
parent12a70404cd164008879e63cc320356e6afee3adc (diff)
downloadrails-5b6eb1d58b48fada298215b2cccda89f993890c3.tar.gz
rails-5b6eb1d58b48fada298215b2cccda89f993890c3.tar.bz2
rails-5b6eb1d58b48fada298215b2cccda89f993890c3.zip
modernizes hash syntax in actionpack
Diffstat (limited to 'actionpack/test/controller/render_json_test.rb')
-rw-r--r--actionpack/test/controller/render_json_test.rb22
1 files changed, 11 insertions, 11 deletions
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