test/test_schema_validator.rb in avro-1.10.1 vs test/test_schema_validator.rb in avro-1.10.2
- old
+ new
@@ -15,11 +15,11 @@
# limitations under the License.
require 'test_help'
class TestSchemaValidator < Test::Unit::TestCase
- def validate!(schema, value, options=nil)
+ def validate!(schema, value, options = {})
Avro::SchemaValidator.validate!(schema, value, options)
end
def validate_simple!(schema, value)
Avro::SchemaValidator.validate!(schema, value, recursive: false)
@@ -192,9 +192,15 @@
def test_validate_record
schema = hash_to_schema(type: 'record', name: 'name', fields: [{ type: 'null', name: 'sub' }])
assert_valid_schema(schema, [{ 'sub' => nil }], [{ 'sub' => 1 }])
+ end
+
+ def test_validate_record_with_symbol_keys
+ schema = hash_to_schema(type: 'record', name: 'name', fields: [{ type: 'int', name: 'sub' }])
+
+ assert_valid_schema(schema, [{ sub: 1 }], [{ sub: '1' }])
end
def test_validate_shallow_record
schema = hash_to_schema(
type: 'record', name: 'name', fields: [{ type: 'int', name: 'sub' }]