mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Fix RuboCop 0.40 linter errors (#1722)
These errors are breaking the build, which seems to use RuboCop 0.40 [1] despite the Gemfile.lock pinning rubocop to 0.38. New lints that I am updating the code style to reflect: - Style/EmptyCaseCondition: Do not use empty case condition, instead use an if expression. - Style/MultilineArrayBraceLayout: Closing array brace must be on the same line as the last array element when opening brace is on the same line as the first array element. - Style/MultilineHashBraceLayout: Closing hash brace must be on the same line as the last hash element when opening brace is on the same line as the first hash element. - Style/MultilineMethodCallBraceLayout: Closing method call brace must be on the line after the last argument when opening brace is on a separate line from the first argument. [1] https://github.com/bbatsov/rubocop/releases/tag/v0.40.0
This commit is contained in:
committed by
L. Preston Sego III
parent
8a3196d920
commit
94db09b3f6
@@ -86,7 +86,8 @@ module ActiveModelSerializers
|
||||
data: [
|
||||
{ id: '7', type: 'comments' },
|
||||
{ id: '12', type: 'comments' }
|
||||
] }
|
||||
]
|
||||
}
|
||||
},
|
||||
links: {
|
||||
self: 'http://example.com/posts/1337',
|
||||
@@ -122,7 +123,8 @@ module ActiveModelSerializers
|
||||
data: [
|
||||
{ id: '7', type: 'comments' },
|
||||
{ id: '12', type: 'comments' }
|
||||
] }
|
||||
]
|
||||
}
|
||||
},
|
||||
links: {
|
||||
self: 'http://example.com/posts/1337',
|
||||
@@ -158,7 +160,8 @@ module ActiveModelSerializers
|
||||
Data: [
|
||||
{ Id: '7', Type: 'Comments' },
|
||||
{ Id: '12', Type: 'Comments' }
|
||||
] }
|
||||
]
|
||||
}
|
||||
},
|
||||
Links: {
|
||||
Self: 'http://example.com/posts/1337',
|
||||
@@ -192,7 +195,8 @@ module ActiveModelSerializers
|
||||
data: [
|
||||
{ id: '7', type: 'comments' },
|
||||
{ id: '12', type: 'comments' }
|
||||
] }
|
||||
]
|
||||
}
|
||||
},
|
||||
links: {
|
||||
self: 'http://example.com/posts/1337',
|
||||
@@ -226,7 +230,8 @@ module ActiveModelSerializers
|
||||
data: [
|
||||
{ id: '7', type: 'comments' },
|
||||
{ id: '12', type: 'comments' }
|
||||
] }
|
||||
]
|
||||
}
|
||||
},
|
||||
links: {
|
||||
self: 'http://example.com/posts/1337',
|
||||
@@ -270,7 +275,8 @@ module ActiveModelSerializers
|
||||
Data: [
|
||||
{ Id: '7', Type: 'Comments' },
|
||||
{ Id: '12', Type: 'Comments' }
|
||||
] }
|
||||
]
|
||||
}
|
||||
},
|
||||
Links: {
|
||||
Self: 'http://example.com/posts/1337',
|
||||
@@ -304,7 +310,8 @@ module ActiveModelSerializers
|
||||
data: [
|
||||
{ id: '7', type: 'comments' },
|
||||
{ id: '12', type: 'comments' }
|
||||
] }
|
||||
]
|
||||
}
|
||||
},
|
||||
links: {
|
||||
self: 'http://example.com/posts/1337',
|
||||
@@ -324,18 +331,18 @@ module ActiveModelSerializers
|
||||
serializer = ActiveModel::Serializer::ErrorSerializer.new(resource)
|
||||
adapter = ActiveModelSerializers::Adapter::JsonApi.new(serializer, @options)
|
||||
result = adapter.serializable_hash
|
||||
expected_errors_object =
|
||||
{ :errors =>
|
||||
[
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/published-at' },
|
||||
:detail => 'must be in the future' },
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/title' },
|
||||
:detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
}
|
||||
expected_errors_object = {
|
||||
:errors => [
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/published-at' },
|
||||
:detail => 'must be in the future'
|
||||
},
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/title' },
|
||||
:detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
}
|
||||
assert_equal expected_errors_object, result
|
||||
end
|
||||
|
||||
@@ -349,19 +356,18 @@ module ActiveModelSerializers
|
||||
adapter = ActiveModelSerializers::Adapter::JsonApi.new(serializer, @options)
|
||||
adapter.serializable_hash
|
||||
end
|
||||
expected_errors_object =
|
||||
{ :Errors =>
|
||||
[
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/PublishedAt' },
|
||||
:Detail => 'must be in the future'
|
||||
},
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/Title' },
|
||||
:Detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
}
|
||||
expected_errors_object = {
|
||||
:Errors => [
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/PublishedAt' },
|
||||
:Detail => 'must be in the future'
|
||||
},
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/Title' },
|
||||
:Detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
}
|
||||
assert_equal expected_errors_object, result
|
||||
end
|
||||
|
||||
@@ -375,19 +381,18 @@ module ActiveModelSerializers
|
||||
adapter = ActiveModelSerializers::Adapter::JsonApi.new(serializer, @options)
|
||||
adapter.serializable_hash
|
||||
end
|
||||
expected_errors_object =
|
||||
{ :Errors =>
|
||||
[
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/PublishedAt' },
|
||||
:Detail => 'must be in the future'
|
||||
},
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/Title' },
|
||||
:Detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
}
|
||||
expected_errors_object = {
|
||||
:Errors => [
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/PublishedAt' },
|
||||
:Detail => 'must be in the future'
|
||||
},
|
||||
{
|
||||
:Source => { :Pointer => '/data/attributes/Title' },
|
||||
:Detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
}
|
||||
assert_equal expected_errors_object, result
|
||||
end
|
||||
|
||||
@@ -402,18 +407,17 @@ module ActiveModelSerializers
|
||||
adapter = ActiveModelSerializers::Adapter::JsonApi.new(serializer, @options)
|
||||
result = adapter.serializable_hash
|
||||
|
||||
expected_errors_object =
|
||||
{ :errors =>
|
||||
[
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/published-at' },
|
||||
:detail => 'must be in the future'
|
||||
},
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/title' },
|
||||
:detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
expected_errors_object = {
|
||||
:errors => [
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/published-at' },
|
||||
:detail => 'must be in the future'
|
||||
},
|
||||
{
|
||||
:source => { :pointer => '/data/attributes/title' },
|
||||
:detail => 'must be longer'
|
||||
}
|
||||
]
|
||||
}
|
||||
assert_equal expected_errors_object, result
|
||||
end
|
||||
@@ -429,12 +433,11 @@ module ActiveModelSerializers
|
||||
adapter = ActiveModelSerializers::Adapter::JsonApi.new(serializer, @options)
|
||||
result = adapter.serializable_hash
|
||||
|
||||
expected_errors_object =
|
||||
{ :errors =>
|
||||
[
|
||||
{ :source => { :pointer => '/data/attributes/published_at' }, :detail => 'must be in the future' },
|
||||
{ :source => { :pointer => '/data/attributes/title' }, :detail => 'must be longer' }
|
||||
]
|
||||
expected_errors_object = {
|
||||
:errors => [
|
||||
{ :source => { :pointer => '/data/attributes/published_at' }, :detail => 'must be in the future' },
|
||||
{ :source => { :pointer => '/data/attributes/title' }, :detail => 'must be longer' }
|
||||
]
|
||||
}
|
||||
assert_equal expected_errors_object, result
|
||||
end
|
||||
@@ -466,12 +469,11 @@ module ActiveModelSerializers
|
||||
adapter = ActiveModelSerializers::Adapter::JsonApi.new(serializer, @options)
|
||||
result = adapter.serializable_hash
|
||||
|
||||
expected_errors_object =
|
||||
{ :Errors =>
|
||||
[
|
||||
{ :Source => { :Pointer => '/data/attributes/PublishedAt' }, :Detail => 'must be in the future' },
|
||||
{ :Source => { :Pointer => '/data/attributes/Title' }, :Detail => 'must be longer' }
|
||||
]
|
||||
expected_errors_object = {
|
||||
:Errors => [
|
||||
{ :Source => { :Pointer => '/data/attributes/PublishedAt' }, :Detail => 'must be in the future' },
|
||||
{ :Source => { :Pointer => '/data/attributes/Title' }, :Detail => 'must be longer' }
|
||||
]
|
||||
}
|
||||
assert_equal expected_errors_object, result
|
||||
end
|
||||
@@ -487,12 +489,11 @@ module ActiveModelSerializers
|
||||
adapter = ActiveModelSerializers::Adapter::JsonApi.new(serializer, @options)
|
||||
result = adapter.serializable_hash
|
||||
|
||||
expected_errors_object =
|
||||
{ :errors =>
|
||||
[
|
||||
{ :source => { :pointer => '/data/attributes/publishedAt' }, :detail => 'must be in the future' },
|
||||
{ :source => { :pointer => '/data/attributes/title' }, :detail => 'must be longer' }
|
||||
]
|
||||
expected_errors_object = {
|
||||
:errors => [
|
||||
{ :source => { :pointer => '/data/attributes/publishedAt' }, :detail => 'must be in the future' },
|
||||
{ :source => { :pointer => '/data/attributes/title' }, :detail => 'must be longer' }
|
||||
]
|
||||
}
|
||||
assert_equal expected_errors_object, result
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user