test/test_schema.rb in avro-salsify-fork-1.9.0.3 vs test/test_schema.rb in avro-salsify-fork-1.9.0.4

- old
+ new

@@ -25,17 +25,17 @@ }}, {"name": "field2", "type": "InnerRecord"} ]} SCHEMA - assert_equal schema.name, 'OuterRecord' - assert_equal schema.fullname, 'OuterRecord' + assert_equal 'OuterRecord', schema.name + assert_equal 'OuterRecord', schema.fullname assert_nil schema.namespace schema.fields.each do |field| - assert_equal field.type.name, 'InnerRecord' - assert_equal field.type.fullname, 'InnerRecord' + assert_equal 'InnerRecord', field.type.name + assert_equal 'InnerRecord', field.type.fullname assert_nil field.type.namespace end end def test_inherited_namespace @@ -48,17 +48,17 @@ {"name": "relativeReference", "type": "InnerRecord"}, {"name": "absoluteReference", "type": "my.name.space.InnerRecord"} ]} SCHEMA - assert_equal schema.name, 'OuterRecord' - assert_equal schema.fullname, 'my.name.space.OuterRecord' - assert_equal schema.namespace, 'my.name.space' + assert_equal 'OuterRecord', schema.name + assert_equal 'my.name.space.OuterRecord', schema.fullname + assert_equal 'my.name.space', schema.namespace schema.fields.each do |field| - assert_equal field.type.name, 'InnerRecord' - assert_equal field.type.fullname, 'my.name.space.InnerRecord' - assert_equal field.type.namespace, 'my.name.space' + assert_equal 'InnerRecord', field.type.name + assert_equal 'my.name.space.InnerRecord', field.type.fullname + assert_equal 'my.name.space', field.type.namespace end end def test_inherited_namespace_from_dotted_name schema = Avro::Schema.parse <<-SCHEMA @@ -69,17 +69,17 @@ {"name": "relativeReference", "type": "InnerEnum"}, {"name": "absoluteReference", "type": "my.name.space.InnerEnum"} ]} SCHEMA - assert_equal schema.name, 'OuterRecord' - assert_equal schema.fullname, 'my.name.space.OuterRecord' - assert_equal schema.namespace, 'my.name.space' + assert_equal 'OuterRecord', schema.name + assert_equal 'my.name.space.OuterRecord', schema.fullname + assert_equal 'my.name.space', schema.namespace schema.fields.each do |field| - assert_equal field.type.name, 'InnerEnum' - assert_equal field.type.fullname, 'my.name.space.InnerEnum' - assert_equal field.type.namespace, 'my.name.space' + assert_equal 'InnerEnum', field.type.name + assert_equal 'my.name.space.InnerEnum', field.type.fullname + assert_equal 'my.name.space', field.type.namespace end end def test_nested_namespaces schema = Avro::Schema.parse <<-SCHEMA @@ -94,22 +94,22 @@ ] }} ]} SCHEMA - assert_equal schema.name, 'OuterRecord' - assert_equal schema.fullname, 'outer.OuterRecord' - assert_equal schema.namespace, 'outer' + assert_equal 'OuterRecord', schema.name + assert_equal 'outer.OuterRecord', schema.fullname + assert_equal 'outer', schema.namespace middle = schema.fields.first.type - assert_equal middle.name, 'MiddleRecord' - assert_equal middle.fullname, 'middle.MiddleRecord' - assert_equal middle.namespace, 'middle' + assert_equal 'MiddleRecord', middle.name + assert_equal 'middle.MiddleRecord', middle.fullname + assert_equal 'middle', middle.namespace inner = middle.fields.first.type - assert_equal inner.name, 'InnerRecord' - assert_equal inner.fullname, 'middle.InnerRecord' - assert_equal inner.namespace, 'middle' - assert_equal inner.fields.first.type, middle + assert_equal 'InnerRecord', inner.name + assert_equal 'middle.InnerRecord', inner.fullname + assert_equal 'middle', inner.namespace + assert_equal middle, inner.fields.first.type end def test_to_avro_includes_namespaces schema = Avro::Schema.parse <<-SCHEMA {"type": "record", "name": "my.name.space.OuterRecord", "fields": [ @@ -118,19 +118,19 @@ }}, {"name": "reference", "type": "InnerFixed"} ]} SCHEMA - assert_equal schema.to_avro, { + assert_equal({ 'type' => 'record', 'name' => 'OuterRecord', 'namespace' => 'my.name.space', 'fields' => [ {'name' => 'definition', 'type' => { 'type' => 'fixed', 'name' => 'InnerFixed', 'namespace' => 'my.name.space', 'size' => 16 }}, {'name' => 'reference', 'type' => 'my.name.space.InnerFixed'} ] - } + }, schema.to_avro) end def test_to_avro_includes_logical_type schema = Avro::Schema.parse <<-SCHEMA {"type": "record", "name": "has_logical", "fields": [