Sha256: 82a91670fe311cd1b451d74a0f1974cf850f4b47d820b86957d1d246a8de18bc
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require 'test_helper' module ActiveModel class Serializer class AssociationMacrosTest < ActiveSupport::TestCase class AuthorSummarySerializer < ActiveModel::Serializer; end class AssociationsTestSerializer < Serializer belongs_to :author, serializer: AuthorSummarySerializer has_many :comments has_one :category end def before_setup @reflections = AssociationsTestSerializer._reflections.values end def test_has_one_defines_reflection has_one_reflection = HasOneReflection.new(:category, {}) assert_includes(@reflections, has_one_reflection) end def test_has_many_defines_reflection has_many_reflection = HasManyReflection.new(:comments, {}) assert_includes(@reflections, has_many_reflection) end def test_belongs_to_defines_reflection belongs_to_reflection = BelongsToReflection.new(:author, serializer: AuthorSummarySerializer) assert_includes(@reflections, belongs_to_reflection) end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
active_model_serializers_custom-0.10.90 | test/serializers/association_macros_test.rb |
active_model_serializers-0.10.9 | test/serializers/association_macros_test.rb |