From f72115fb7990ef66236e066afaf2dd0cec727ebb Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Mon, 16 Dec 2013 17:45:24 -0200 Subject: [PATCH] Test association inheritance in serializers --- .../serializer/associations_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/unit/active_model/serializer/associations_test.rb diff --git a/test/unit/active_model/serializer/associations_test.rb b/test/unit/active_model/serializer/associations_test.rb new file mode 100644 index 00000000..4e684b4d --- /dev/null +++ b/test/unit/active_model/serializer/associations_test.rb @@ -0,0 +1,19 @@ +require 'test_helper' + +module ActiveModel + class Serializer + class AssociationsTest < ActiveModel::TestCase + def test_associations_inheritance + inherited_serializer_klass = Class.new(PostSerializer) do + has_many :users + end + another_inherited_serializer_klass = Class.new(PostSerializer) + + assert_equal([:comments, :users], + inherited_serializer_klass._associations.keys) + assert_equal([:comments], + another_inherited_serializer_klass._associations.keys) + end + end + end +end