mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Style/StringLiterals single quote all the things
This commit is contained in:
@@ -21,20 +21,20 @@ module ActionController
|
||||
def render_array_using_custom_root
|
||||
with_adapter ActiveModel::Serializer::Adapter::Json do
|
||||
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||
render json: [@profile], root: "custom_root"
|
||||
render json: [@profile], root: 'custom_root'
|
||||
end
|
||||
end
|
||||
|
||||
def render_array_that_is_empty_using_custom_root
|
||||
with_adapter ActiveModel::Serializer::Adapter::Json do
|
||||
render json: [], root: "custom_root"
|
||||
render json: [], root: 'custom_root'
|
||||
end
|
||||
end
|
||||
|
||||
def render_object_using_custom_root
|
||||
with_adapter ActiveModel::Serializer::Adapter::Json do
|
||||
@profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' })
|
||||
render json: @profile, root: "custom_root"
|
||||
render json: @profile, root: 'custom_root'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -159,8 +159,8 @@ module ActionController
|
||||
get :render_using_implicit_serializer
|
||||
|
||||
expected = {
|
||||
name: "Name 1",
|
||||
description: "Description 1"
|
||||
name: 'Name 1',
|
||||
description: 'Description 1'
|
||||
}
|
||||
|
||||
assert_equal 'application/json', @response.content_type
|
||||
@@ -173,10 +173,10 @@ module ActionController
|
||||
expected = {
|
||||
data: {
|
||||
id: assigns(:profile).id.to_s,
|
||||
type: "profiles",
|
||||
type: 'profiles',
|
||||
attributes: {
|
||||
name: "Name 1",
|
||||
description: "Description 1"
|
||||
name: 'Name 1',
|
||||
description: 'Description 1'
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,7 +188,7 @@ module ActionController
|
||||
def test_render_array_using_custom_root
|
||||
get :render_array_using_custom_root
|
||||
|
||||
expected = {custom_roots: [{name: "Name 1", description: "Description 1"}]}
|
||||
expected = {custom_roots: [{name: 'Name 1', description: 'Description 1'}]}
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal expected.to_json, @response.body
|
||||
end
|
||||
@@ -250,10 +250,10 @@ module ActionController
|
||||
data: [
|
||||
{
|
||||
id: assigns(:profiles).first.id.to_s,
|
||||
type: "profiles",
|
||||
type: 'profiles',
|
||||
attributes: {
|
||||
name: "Name 1",
|
||||
description: "Description 1"
|
||||
name: 'Name 1',
|
||||
description: 'Description 1'
|
||||
}
|
||||
}
|
||||
],
|
||||
@@ -335,8 +335,8 @@ module ActionController
|
||||
response = JSON.parse(@response.body)
|
||||
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal 'ZOMG A ROLE', response["name"]
|
||||
assert_equal 'HUEHUEBRBR', response["description"]
|
||||
assert_equal 'ZOMG A ROLE', response['name']
|
||||
assert_equal 'HUEHUEBRBR', response['description']
|
||||
end
|
||||
|
||||
def test_render_with_fragment_except_cache_enable
|
||||
@@ -345,8 +345,8 @@ module ActionController
|
||||
response = JSON.parse(@response.body)
|
||||
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal 5, response["rating"]
|
||||
assert_equal 'lol', response["content"]
|
||||
assert_equal 5, response['rating']
|
||||
assert_equal 'lol', response['content']
|
||||
end
|
||||
|
||||
def test_render_fragment_changed_object_with_relationship
|
||||
@@ -357,11 +357,11 @@ module ActionController
|
||||
response = JSON.parse(@response.body)
|
||||
|
||||
expected_return = {
|
||||
"id"=>1,
|
||||
"time"=>Time.now.to_s,
|
||||
"likeable" => {
|
||||
"id"=>1,
|
||||
"body"=>"ZOMG A COMMENT"
|
||||
'id'=>1,
|
||||
'time'=>Time.now.to_s,
|
||||
'likeable' => {
|
||||
'id'=>1,
|
||||
'body'=>'ZOMG A COMMENT'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,7 +385,7 @@ module ActionController
|
||||
],
|
||||
blog: {
|
||||
id:999,
|
||||
name: "Custom blog"
|
||||
name: 'Custom blog'
|
||||
},
|
||||
author: {
|
||||
id: 1,
|
||||
@@ -416,7 +416,7 @@ module ActionController
|
||||
true
|
||||
end
|
||||
}.new
|
||||
assert_equal "", (capture(:stderr) {
|
||||
assert_equal '', (capture(:stderr) {
|
||||
controller.get_serializer(Profile.new)
|
||||
})
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user