Sha256: f24f66ee1cd5058b74a264b9a6a3a4de755fdc21ec852010f32a02746464d980
Contents?: true
Size: 877 Bytes
Versions: 2
Compression:
Stored size: 877 Bytes
Contents
require 'test_helper' module ActiveModel class Serializer class AttributesTest < ActiveRecord::TestCase def setup @profile = Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }) @profile_serializer = ProfileSerializer.new(@profile) end def test_attributes_definition assert_equal([:name, :description], @profile_serializer.class._attributes) end def test_attributes_serialization_using_serializable_hash assert_equal({ name: 'Name 1', description: 'Description 1' }, @profile_serializer.serializable_hash) end def test_attributes_serialization_using_as_json assert_equal({ 'profile' => { name: 'Name 1', description: 'Description 1' } }, @profile_serializer.as_json) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems