mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 23:06:50 +00:00
Split basic object and model array serialization tests
This commit is contained in:
parent
5c00ce0443
commit
af7437b7e4
@ -2,7 +2,7 @@ require 'test_helper'
|
|||||||
|
|
||||||
module ActiveModel
|
module ActiveModel
|
||||||
class ArraySerializer
|
class ArraySerializer
|
||||||
class SerializeTest < ActiveModel::TestCase
|
class BasicObjectsSerializationTest < ActiveModel::TestCase
|
||||||
def setup
|
def setup
|
||||||
array = [1, 2, 3]
|
array = [1, 2, 3]
|
||||||
@serializer = ActiveModel::Serializer.serializer_for(array).new(array)
|
@serializer = ActiveModel::Serializer.serializer_for(array).new(array)
|
||||||
@ -16,7 +16,9 @@ module ActiveModel
|
|||||||
assert_equal [1, 2, 3], @serializer.serializable_array
|
assert_equal [1, 2, 3], @serializer.serializable_array
|
||||||
assert_equal [1, 2, 3], @serializer.as_json
|
assert_equal [1, 2, 3], @serializer.as_json
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class ModelSerializationTest < ActiveModel::TestCase
|
||||||
def test_array_serializer_serializes_models
|
def test_array_serializer_serializes_models
|
||||||
array = [Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }),
|
array = [Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }),
|
||||||
Profile.new({ name: 'Name 2', description: 'Description 2', comments: 'Comments 2' })]
|
Profile.new({ name: 'Name 2', description: 'Description 2', comments: 'Comments 2' })]
|
||||||
Loading…
Reference in New Issue
Block a user