mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user