Skip to content

Commit

Permalink
updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura authored and João M. D. Moura committed Jul 23, 2015
1 parent 4187213 commit 9817a5b
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion test/adapter/json/belongs_to_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_include_nil_author_with_specified_serializer
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
Expand Down
2 changes: 1 addition & 1 deletion test/adapter/json/collection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_with_serializer_option
@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"}]
Expand Down
2 changes: 1 addition & 1 deletion test/adapter/json/has_many_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_has_many_with_no_serializer
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
Expand Down
3 changes: 1 addition & 2 deletions test/adapter/json_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,9 @@ def test_custom_keys
],
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

2 changes: 1 addition & 1 deletion test/serializers/attribute_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_attributes_definition

def test_json_serializable_hash
adapter = ActiveModel::Serializer::Adapter::Json.new(@blog_serializer)
assert_equal({alternate_blog: { id:1, title:"AMS Hints"}}, adapter.serializable_hash)
assert_equal({blog: { id:1, title:"AMS Hints"}}, adapter.serializable_hash)
end

def test_attribute_inheritance_with_key
Expand Down
4 changes: 2 additions & 2 deletions test/serializers/meta_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_meta_is_present_with_root
serializer = AlternateBlogSerializer.new(@blog, meta: {total: 10})
adapter = ActiveModel::Serializer::Adapter::Json.new(serializer)
expected = {
alternate_blog: {
blog: {
id: 1,
title: "AMS Hints"
},
Expand All @@ -40,7 +40,7 @@ def test_meta_key_is_used
serializer = AlternateBlogSerializer.new(@blog, meta: {total: 10}, meta_key: "haha_meta")
adapter = ActiveModel::Serializer::Adapter::Json.new(serializer)
expected = {
alternate_blog: {
blog: {
id: 1,
title: "AMS Hints"
},
Expand Down

0 comments on commit 9817a5b

Please sign in to comment.