mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
test array serializer context
This commit is contained in:
parent
0e7cae4d6d
commit
e0690862ce
16
test/unit/active_model/array_serializer/options_test.rb
Normal file
16
test/unit/active_model/array_serializer/options_test.rb
Normal file
@ -0,0 +1,16 @@
|
||||
require 'test_helper'
|
||||
|
||||
module ActiveModel
|
||||
class ArraySerializer
|
||||
class OptionsTest < Minitest::Test
|
||||
def test_custom_options_are_accessible_from_serializer
|
||||
|
||||
array = [Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }),
|
||||
Profile.new({ name: 'Name 2', description: 'Description 2', comments: 'Comments 2' })]
|
||||
serializer = ArraySerializer.new(array, only: [:name], context: {foo: :bar})
|
||||
|
||||
assert_equal({foo: :bar}, serializer.context)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue
Block a user