Skip to content
Browse files

Merge pull request #175 from jlecour/deducted_serializer_test

Test : use a deducted serializer on non-ActiveRecord models
  • Loading branch information...
2 parents 89660d1 + c68a186 commit a74fc6c8dbf3cd49c99a44239a2725c8ae3ea8e4 @carlosantoniodasilva carlosantoniodasilva committed Dec 21, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 test/serializer_support_test.rb
View
11 test/serializer_support_test.rb
@@ -4,6 +4,13 @@ class RandomModel
include ActiveModel::SerializerSupport
end
+class OtherRandomModel
+ include ActiveModel::SerializerSupport
+end
+
+class OtherRandomModelSerializer
+end
+
class RandomModelCollection
include ActiveModel::ArraySerializerSupport
end
@@ -18,6 +25,10 @@ class SerializerSupportTest < ActiveModel::TestCase
assert_equal nil, RandomModel.new.active_model_serializer
end
+ test "it returns a deducted serializer if it exists exists" do
+ assert_equal OtherRandomModelSerializer, OtherRandomModel.new.active_model_serializer
+ end
+
test "it returns ArraySerializer for a collection" do
assert_equal ActiveModel::ArraySerializer, RandomModelCollection.new.active_model_serializer
end

0 comments on commit a74fc6c

Please sign in to comment.
Something went wrong with that request. Please try again.