Sha256: bbc6eba28b2bd4845b9793c2010b30b1042a51fc27f8aa73ceb3a3f19607f46e
Contents?: true
Size: 1.28 KB
Versions: 21
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true describe AvroTurf::SchemaStore do it 'should add an in-memory schema' do schema_store = described_class.new(path: Deimos.config.schema_path) schema_store.load_schemas! found_schema = schema_store.find('MySchema', 'com.my-namespace').as_json expect(found_schema['name']).to eq('MySchema') expect(found_schema['namespace']).to eq('com.my-namespace') expect(found_schema['fields'].size).to eq(2) expect(found_schema['fields'][0]['type']['type_sym']).to eq('string') expect(found_schema['fields'][0]['name']).to eq('test_id') new_schema = { 'namespace' => 'com.my-namespace', 'name' => 'MyNewSchema', 'type' => 'record', 'doc' => 'Test schema', 'fields' => [ { 'name' => 'my_id', 'type' => 'int', 'doc' => 'test int' } ] } schema_store.add_schema(new_schema) found_schema = schema_store.find('MyNewSchema', 'com.my-namespace'). as_json expect(found_schema['name']).to eq('MyNewSchema') expect(found_schema['namespace']).to eq('com.my-namespace') expect(found_schema['fields'].size).to eq(1) expect(found_schema['fields'][0]['type']['type_sym']).to eq('int') expect(found_schema['fields'][0]['name']).to eq('my_id') end end
Version data entries
21 entries across 21 versions & 2 rubygems