Rubocop autocorrect

This commit is contained in:
Benjamin Fleischer
2016-02-04 22:39:20 -06:00
committed by Yohan Robert
parent ec36ab7f60
commit a26d3e4425
21 changed files with 39 additions and 39 deletions

View File

@@ -36,7 +36,7 @@ module ActionController
type: 'profiles',
attributes: {
name: 'Name 1',
description: 'Description 1',
description: 'Description 1'
}
}
}

View File

@@ -8,8 +8,8 @@ module ActionController
module Serialization
class JsonApi
class PaginationTest < ActionController::TestCase
KAMINARI_URI = 'http://test.host/action_controller/serialization/json_api/pagination_test/pagination_test/render_pagination_using_kaminari'
WILL_PAGINATE_URI = 'http://test.host/action_controller/serialization/json_api/pagination_test/pagination_test/render_pagination_using_will_paginate'
KAMINARI_URI = 'http://test.host/action_controller/serialization/json_api/pagination_test/pagination_test/render_pagination_using_kaminari'.freeze
WILL_PAGINATE_URI = 'http://test.host/action_controller/serialization/json_api/pagination_test/pagination_test/render_pagination_using_will_paginate'.freeze
class PaginationTestController < ActionController::Base
def setup

View File

@@ -91,7 +91,7 @@ module ActionController
expires_in = [
PostSerializer._cache_options[:expires_in],
CommentSerializer._cache_options[:expires_in],
CommentSerializer._cache_options[:expires_in]
].max + 200
Timecop.travel(Time.zone.now + expires_in) do

View File

@@ -43,7 +43,7 @@ module ActiveModelSerializers
type: 'posts',
attributes: {
title: 'New Post',
body: 'Body',
body: 'Body'
},
relationships: {
comments: { data: [{ type: 'comments', id: '1' }] },

View File

@@ -60,7 +60,7 @@ module ActiveModelSerializers
actual = ActiveModel::SerializableResource.new(
[@first_post, @second_post], adapter: :json_api,
fields: { posts: %w(title comments blog author) })
.serializable_hash
.serializable_hash
expected = [
{
id: '1',

View File

@@ -98,7 +98,7 @@ module ActiveModelSerializers
id: '2',
type: 'comments',
attributes: {
body: 'ZOMG ANOTHER COMMENT',
body: 'ZOMG ANOTHER COMMENT'
},
relationships: {
post: { data: { type: 'posts', id: '10' } },
@@ -141,7 +141,7 @@ module ActiveModelSerializers
type: 'bios',
attributes: {
rating: nil,
content: 'Rails Contributor',
content: 'Rails Contributor'
},
relationships: {
author: { data: { type: 'authors', id: '2' } }
@@ -314,7 +314,7 @@ module ActiveModelSerializers
def test_no_duplicates
hash = ActiveModel::SerializableResource.new(@post1, adapter: :json_api,
include: '*.*')
.serializable_hash
.serializable_hash
expected = [
{
type: 'authors', id: '1',
@@ -343,7 +343,7 @@ module ActiveModelSerializers
hash = ActiveModel::SerializableResource.new(
[@post1, @post2], adapter: :json_api,
include: '*.*')
.serializable_hash
.serializable_hash
expected = [
{
type: 'authors', id: '1',

View File

@@ -8,7 +8,7 @@ module ActiveModelSerializers
module Adapter
class JsonApi
class PaginationLinksTest < ActiveSupport::TestCase
URI = 'http://example.com'
URI = 'http://example.com'.freeze
def setup
ActionController::Base.cache_store.clear

View File

@@ -77,22 +77,22 @@ module ActiveModelSerializers
end
def test_relationship_block_link
links = { self: proc { "#{object.id}" } }
expected = { links: { self: "#{@blog.id}" } }
links = { self: proc { object.id.to_s } }
expected = { links: { self: @blog.id.to_s } }
test_relationship(expected, links: links)
end
def test_relationship_block_link_with_meta
links = {
self: proc do
href "#{object.id}"
href object.id.to_s
meta(id: object.id)
end
}
expected = {
links: {
self: {
href: "#{@blog.id}",
href: @blog.id.to_s,
meta: { id: @blog.id }
}
}
@@ -122,7 +122,7 @@ module ActiveModelSerializers
links = {
self: 'a link',
related: proc do
href "#{object.id}"
href object.id.to_s
meta object.id
end

View File

@@ -15,11 +15,11 @@ class ActiveModelSerializers::GrapeTest < ActiveSupport::TestCase
def self.all
@all ||=
begin
model1.save!
model2.save!
ARModels::Post.all
end
begin
model1.save!
model2.save!
ARModels::Post.all
end
end
end

View File

@@ -60,8 +60,8 @@ module ActiveModel
def test_serializer_options_are_passed_into_associations_serializers
association = @post_serializer
.associations
.detect { |assoc| assoc.key == :comments }
.associations
.detect { |assoc| assoc.key == :comments }
assert association.serializer.first.custom_options[:custom_options]
end
@@ -143,11 +143,11 @@ module ActiveModel
)
actual = serializable(post, adapter: :attributes, serializer: InlineAssociationTestPostSerializer).as_json
expected = {
:comments => [
:comments => [
{ :id => 1, :contents => 'first comment' },
{ :id => 2, :contents => 'last comment' }
],
:last_comments => [
:last_comments => [
{ :id => 2, :contents => 'last comment' }
]
}

View File

@@ -1,7 +1,7 @@
module Rails5Shims
module ControllerTests
# https://github.com/rails/rails/blob/b217354/actionpack/lib/action_controller/test_case.rb
REQUEST_KWARGS = [:params, :session, :flash, :method, :body, :xhr]
REQUEST_KWARGS = [:params, :session, :flash, :method, :body, :xhr].freeze
# Fold kwargs from test request into args
# Band-aid for DEPRECATION WARNING

View File

@@ -21,7 +21,7 @@ module SerializationTesting
ensure
ActiveModelSerializers.config.adapter = old_adapter
end
alias_method :with_configured_adapter, :with_adapter
alias with_configured_adapter with_adapter
def with_config(hash)
old_config = config.dup