Skip to content

Commit 6119d49

Browse files
committed
adding test for correct failed_attribute
1 parent 0b99288 commit 6119d49

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/custom_format_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ def test_format_validation
9696
assert_equal(1, errors.count)
9797
assert_match(%r{The property '#/a' must be 42 in schema}, errors.first, "#{prefix} records format error")
9898

99+
errors_as_objects = JSON::Validator.fully_validate(schema, data, errors_as_objects: true)
100+
101+
assert_match('CustomFormat', errors_as_objects.first[:failed_attribute], "#{prefix} tags failed attribute")
102+
99103
data['a'] = 23
100104
errors = JSON::Validator.fully_validate(schema, data)
101105

0 commit comments

Comments
 (0)