Skip to content

Commit e069086

Browse files
committed
test array serializer context
1 parent 0e7cae4 commit e069086

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
require 'test_helper'
2+
3+
module ActiveModel
4+
class ArraySerializer
5+
class OptionsTest < Minitest::Test
6+
def test_custom_options_are_accessible_from_serializer
7+
8+
array = [Profile.new({ name: 'Name 1', description: 'Description 1', comments: 'Comments 1' }),
9+
Profile.new({ name: 'Name 2', description: 'Description 2', comments: 'Comments 2' })]
10+
serializer = ArraySerializer.new(array, only: [:name], context: {foo: :bar})
11+
12+
assert_equal({foo: :bar}, serializer.context)
13+
end
14+
end
15+
end
16+
end

0 commit comments

Comments
 (0)