test/serializers/associations_test.rb in cheap_ams-0.10.5 vs test/serializers/associations_test.rb in cheap_ams-0.10.6
- old
+ new
@@ -2,11 +2,11 @@
module ActiveModel
class Serializer
class AssociationsTest < Minitest::Test
class Model
- def initialize(hash={})
+ def initialize(hash = {})
@attributes = hash
end
def read_attribute_for_serialization(name)
@attributes[name]
@@ -27,21 +27,21 @@
@author = Author.new(name: 'Steve K.')
@author.bio = nil
@author.roles = []
@blog = Blog.new({ name: 'AMS Blog' })
@post = Post.new({ title: 'New Post', body: 'Body' })
- @tag = Tag.new({name: '#hashtagged'})
+ @tag = Tag.new({ name: '#hashtagged' })
@comment = Comment.new({ id: 1, body: 'ZOMG A COMMENT' })
@post.comments = [@comment]
@post.tags = [@tag]
@post.blog = @blog
@comment.post = @post
@comment.author = nil
@post.author = @author
@author.posts = [@post]
- @post_serializer = PostSerializer.new(@post, {custom_options: true})
+ @post_serializer = PostSerializer.new(@post, { custom_options: true })
@author_serializer = AuthorSerializer.new(@author)
@comment_serializer = CommentSerializer.new(@comment)
end
def test_has_many_and_has_one
@@ -72,10 +72,10 @@
serializer = association.serializer
options = association.options
assert_equal key, :tags
assert_equal serializer, nil
- assert_equal [{ attributes: { name: "#hashtagged" }}].to_json, options[:virtual_value].to_json
+ assert_equal [{ attributes: { name: '#hashtagged' } }].to_json, options[:virtual_value].to_json
end
end
def test_serializer_options_are_passed_into_associations_serializers
association = @post_serializer