From 9817a5b5955a1e2432fdc89c85a293bbcf3f1b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Fri, 10 Jul 2015 12:02:24 -0300 Subject: [PATCH] updating tests --- test/adapter/json/belongs_to_test.rb | 2 +- test/adapter/json/collection_test.rb | 2 +- test/adapter/json/has_many_test.rb | 2 +- test/adapter/json_test.rb | 3 +-- test/serializers/attribute_test.rb | 2 +- test/serializers/meta_test.rb | 4 ++-- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/test/adapter/json/belongs_to_test.rb b/test/adapter/json/belongs_to_test.rb index 1d20d1c9..a5dbfe14 100644 --- a/test/adapter/json/belongs_to_test.rb +++ b/test/adapter/json/belongs_to_test.rb @@ -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 diff --git a/test/adapter/json/collection_test.rb b/test/adapter/json/collection_test.rb index 54bc5431..3643ca23 100644 --- a/test/adapter/json/collection_test.rb +++ b/test/adapter/json/collection_test.rb @@ -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"}] diff --git a/test/adapter/json/has_many_test.rb b/test/adapter/json/has_many_test.rb index a88b2f54..14e27fc3 100644 --- a/test/adapter/json/has_many_test.rb +++ b/test/adapter/json/has_many_test.rb @@ -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 diff --git a/test/adapter/json_test.rb b/test/adapter/json_test.rb index 4aeb034f..4acf0dbb 100644 --- a/test/adapter/json_test.rb +++ b/test/adapter/json_test.rb @@ -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 - diff --git a/test/serializers/attribute_test.rb b/test/serializers/attribute_test.rb index 1b52216a..c945a8fc 100644 --- a/test/serializers/attribute_test.rb +++ b/test/serializers/attribute_test.rb @@ -15,7 +15,7 @@ module ActiveModel 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 diff --git a/test/serializers/meta_test.rb b/test/serializers/meta_test.rb index 858a29a5..4b501756 100644 --- a/test/serializers/meta_test.rb +++ b/test/serializers/meta_test.rb @@ -15,7 +15,7 @@ module ActiveModel serializer = AlternateBlogSerializer.new(@blog, meta: {total: 10}) adapter = ActiveModel::Serializer::Adapter::Json.new(serializer) expected = { - alternate_blog: { + blog: { id: 1, title: "AMS Hints" }, @@ -40,7 +40,7 @@ module ActiveModel 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" },