Sha256: 8a657260f5db22972ca1cebddaa9997a8b4f5fadf4edca3700b484d5616078cb
Contents?: true
Size: 999 Bytes
Versions: 2
Compression:
Stored size: 999 Bytes
Contents
require 'test_helper' module ActiveModel class Serializer class MetaTest < ActiveRecord::TestCase def setup @profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }) end def test_meta profile_serializer = ProfileSerializer.new(@profile, root: 'profile', meta: { total: 10 }) assert_equal({ 'profile' => { name: 'Name 1', description: 'Description 1' }, meta: { total: 10 } }, profile_serializer.as_json) end def test_meta_using_meta_key profile_serializer = ProfileSerializer.new(@profile, root: 'profile', meta_key: :my_meta, my_meta: { total: 10 }) assert_equal({ 'profile' => { name: 'Name 1', description: 'Description 1' }, my_meta: { total: 10 } }, profile_serializer.as_json) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_model_serializers_rails_2.3-0.9.0.pre2 | test/unit/active_model/serializer/meta_test.rb |
active_model_serializers_rails_2.3-0.9.0.pre1 | test/unit/active_model/serializer/meta_test.rb |