mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
updating tests
This commit is contained in:
committed by
João M. D. Moura
parent
418721302b
commit
9817a5b595
@@ -39,7 +39,7 @@ module ActiveModel
|
||||
serializer = PostPreviewSerializer.new(@anonymous_post)
|
||||
adapter = ActiveModel::Serializer::Adapter::Json.new(serializer)
|
||||
|
||||
assert_equal({posts: {title: "Hello!!", body: "Hello, world!!", id: 43, comments: [], author: nil}}, adapter.serializable_hash)
|
||||
assert_equal({post: {title: "Hello!!", body: "Hello, world!!", id: 43, comments: [], author: nil}}, adapter.serializable_hash)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ module ActiveModel
|
||||
@serializer = ArraySerializer.new([@blog], serializer: CustomBlogSerializer)
|
||||
@adapter = ActiveModel::Serializer::Adapter::Json.new(@serializer)
|
||||
|
||||
expected = {custom_blogs:[{
|
||||
expected = {blogs:[{
|
||||
id: 1,
|
||||
special_attribute: "Special",
|
||||
articles: [{id: 1,title: "Hello!!", body: "Hello, world!!"}, {id: 2, title: "New Post", body: "Body"}]
|
||||
|
||||
@@ -38,7 +38,7 @@ module ActiveModel
|
||||
tags: [
|
||||
{"attributes"=>{"id"=>1, "name"=>"#hash_tag"}}
|
||||
]
|
||||
}.to_json, adapter.serializable_hash[:post_with_tags].to_json)
|
||||
}.to_json, adapter.serializable_hash[:post].to_json)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,10 +39,9 @@ module ActiveModel
|
||||
],
|
||||
writer: {id: 1, name: "Steve K."},
|
||||
site: {id: 1, name: "My Blog!!"}
|
||||
}, adapter.serializable_hash[:post_with_custom_keys])
|
||||
}, adapter.serializable_hash[:post])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user