test/unit/schemacop/v3/object_node_test.rb in schemacop-3.0.9 vs test/unit/schemacop/v3/object_node_test.rb in schemacop-3.0.10
- old
+ new
@@ -26,14 +26,14 @@
def test_with_classes
schema :object, classes: [String, Date]
assert_validation 'foo'
assert_validation Date.today
assert_validation({}.with_indifferent_access) do
- error '/', 'Invalid type, expected "Date" or "String".'
+ error '/', 'Invalid type, got type "ActiveSupport::HashWithIndifferentAccess", expected "Date" or "String".'
end
assert_validation DateTime.now do
- error '/', 'Invalid type, expected "Date" or "String".'
+ error '/', 'Invalid type, got type "DateTime", expected "Date" or "String".'
end
end
def test_non_strict
schema :object, classes: [String, Date, Hash], strict: false
@@ -42,11 +42,11 @@
assert_validation Date.today
assert_validation nil
assert_validation DateTime.now
assert_validation({}.with_indifferent_access)
assert_validation Time.now do
- error '/', 'Invalid type, expected "Date" or "Hash" or "String".'
+ error '/', 'Invalid type, got type "Time", expected "Date" or "Hash" or "String".'
end
end
def test_required
schema :object, required: true
@@ -72,11 +72,11 @@
additionalProperties: false
)
assert_validation myobj: ''
assert_validation myobj: '42'
assert_validation myobj: Date.today do
- error '/myobj', 'Invalid type, expected "String".'
+ error '/myobj', 'Invalid type, got type "Date", expected "String".'
end
assert_validation({}) do
error '/myobj', 'Value must be given.'
end
end
@@ -132,16 +132,16 @@
assert_validation('foo')
assert_validation(:baz)
# These will fail, as they aren't of one of the classed we defined above
assert_validation([]) do
- error '/', 'Invalid type, expected "String" or "Symbol" or "TrueClass".'
+ error '/', 'Invalid type, got type "Array", expected "String" or "Symbol" or "TrueClass".'
end
assert_validation({ qux: '123' }) do
- error '/', 'Invalid type, expected "String" or "Symbol" or "TrueClass".'
+ error '/', 'Invalid type, got type "Hash", expected "String" or "Symbol" or "TrueClass".'
end
assert_validation(false) do
- error '/', 'Invalid type, expected "String" or "Symbol" or "TrueClass".'
+ error '/', 'Invalid type, got type "FalseClass", expected "String" or "Symbol" or "TrueClass".'
end
end
def test_with_generic_keywords
schema :object, enum: [1, 'foo'],