mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Test association inheritance in serializers
This commit is contained in:
parent
115de49004
commit
f72115fb79
19
test/unit/active_model/serializer/associations_test.rb
Normal file
19
test/unit/active_model/serializer/associations_test.rb
Normal file
@ -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
|
||||
Loading…
Reference in New Issue
Block a user