Sha256: 77b9756c85ad1bda848d79f7539e47eb6ebcd5dd67340084e22592d3bac3661b

Contents?: true

Size: 543 Bytes

Versions: 9

Compression:

Stored size: 543 Bytes

Contents

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_model_serializers-0.9.13 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.12 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.11 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.9 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.8 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.7 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.6 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.5 test/unit/active_model/array_serializer/options_test.rb
active_model_serializers-0.9.4 test/unit/active_model/array_serializer/options_test.rb