Sha256: 49b30a34665bd9f648b82dc3d8427aea9ebb7627e0decc597ffc901e3fd43c4c
Contents?: true
Size: 1.1 KB
Versions: 30
Compression:
Stored size: 1.1 KB
Contents
RSpec.describe :register_type do link :register_type, from: :ree_swagger link :build_serializer_schema, from: :ree_swagger link :build_mapper_factory, from: :ree_mapper link :build_mapper_strategy, from: :ree_mapper class ReeSwagger::MyType < ReeMapper::AbstractType def serialize(obj, role: nil) obj.inspect end end let(:mapper_factory) { strategies = [ build_mapper_strategy(method: :serialize, output: :symbol_key_hash), ] build_mapper_factory(strategies: strategies).register( :my_type, ReeMapper::Mapper.build( strategies, ReeSwagger::MyType.new ) ) } let(:mapper) { mapper_factory.call.use(:serialize) do my_type :name end } before do register_type( :serializers, ReeSwagger::MyType, ->(my_type, build_serializer_schema) { { type: 'string' } } ) end it { expect(build_serializer_schema(mapper)).to eq( { type: 'object', properties: { name: { type: 'string' } } } ) } end
Version data entries
30 entries across 30 versions & 1 rubygems