From 9962069ae905b8797e4971a04c43eb6680c62e09 Mon Sep 17 00:00:00 2001 From: Tee Parham Date: Wed, 30 May 2012 10:55:35 -0600 Subject: [PATCH 1/2] delete identical test --- test/association_test.rb | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/test/association_test.rb b/test/association_test.rb index 31b6175c..d174e196 100644 --- a/test/association_test.rb +++ b/test/association_test.rb @@ -185,24 +185,6 @@ class AssociationTest < ActiveModel::TestCase }, @root_hash) end - def test_with_default_has_one_with_custom_key - @post_serializer_class.class_eval do - has_one :comment, :key => :custom_comment - end - - include! :comment - - assert_equal({ - :custom_comment => 1 - }, @hash) - - assert_equal({ - :custom_comments => [ - { :id => 1, :body => "ZOMG A COMMENT" } - ] - }, @root_hash) - end - def test_embed_objects_for_has_many_associations @post_serializer_class.class_eval do has_many :comments, :embed => :objects From 00db4dd6db4d8fe3828b5c2877d32cf3d37e6a57 Mon Sep 17 00:00:00 2001 From: Tee Parham Date: Wed, 30 May 2012 11:07:06 -0600 Subject: [PATCH 2/2] rename test methods so tests run incidentally test_array_serializer_with_root fails --- test/serialization_test.rb | 2 +- test/serializer_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/serialization_test.rb b/test/serialization_test.rb index 03a5d4a8..15449e0b 100644 --- a/test/serialization_test.rb +++ b/test/serialization_test.rb @@ -217,7 +217,7 @@ class RenderJsonTest < ActionController::TestCase assert_match '"object":{"serializable_object":true}', @response.body end - def test_render_json_with_serializer + def test_render_json_with_serializer_checking_defaults get :render_json_with_serializer, :check_defaults => true assert_match '"scope":{"current_user":true}', @response.body assert_match '"object":{"serializable_object":true}', @response.body diff --git a/test/serializer_test.rb b/test/serializer_test.rb index 8d31d8dc..d6ade23c 100644 --- a/test/serializer_test.rb +++ b/test/serializer_test.rb @@ -384,12 +384,12 @@ class SerializerTest < ActiveModel::TestCase serializer = array.active_model_serializer.new(array, {:scope => true}) assert_equal([ { :model => "Model" }, - { :user => { :last_name=>"Valim", :ok=>true, :first_name=>"Jose", :scope => true } }, + { :user => { :last_name=> "Valim", :ok => true, :first_name => "Jose", :scope => true } }, { :comment => { :title => "Comment1" } } ], serializer.as_json) end - def test_array_serializer + def test_array_serializer_with_root comment1 = Comment.new(:title => "Comment1", :id => 1) comment2 = Comment.new(:title => "Comment2", :id => 2)