Add some failing tests around has_many assocs...

..where no serializer is defined for the thing that is has_many'd
This commit is contained in:
Justin Aiken
2015-06-12 15:05:33 -06:00
committed by João Moura
parent 189b79523c
commit 3710c32cee
4 changed files with 31 additions and 1 deletions

View File

@@ -29,8 +29,10 @@ module ActiveModel
@author.roles = []
@blog = Blog.new({ name: 'AMS Blog' })
@post = Post.new({ title: 'New Post', body: 'Body' })
@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
@@ -65,6 +67,12 @@ module ActiveModel
end
end
def test_has_many_with_no_serializer
PostWithTagsSerializer.new(@post).each_association do |name, serializer, options|
puts "The line above will crash this test"
end
end
def test_serializer_options_are_passed_into_associations_serializers
@post_serializer.each_association do |name, association|
if name == :comments