From c65ee8a551c92b1ba8bcd8c5e7b077f75c2aa8de Mon Sep 17 00:00:00 2001 From: Robert Haines Date: Thu, 22 Feb 2024 17:00:08 +0000 Subject: [PATCH] Ensure that `complete.cff` is validated in the tests. --- test/validatable_test.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/validatable_test.rb b/test/validatable_test.rb index 133b91a..d06fb53 100644 --- a/test/validatable_test.rb +++ b/test/validatable_test.rb @@ -69,6 +69,30 @@ def test_short_example_file_validate refute(result[2]) end + def test_complete_example_file_validate! + cff = ::CFF::File.read(COMPLETE_CFF) + + assert_raises(::CFF::ValidationError) do + cff.validate! + end + + cff.validate!(fail_on_filename: false) + end + + def test_complete_example_file_validate + cff = ::CFF::File.read(COMPLETE_CFF) + + result = cff.validate + refute(result[0]) + assert_empty(result[1]) + refute(result[2]) + + result = cff.validate(fail_on_filename: false) + assert(result[0]) + assert_empty(result[1]) + refute(result[2]) + end + def test_empty_cff_version_raises_error cff = ::CFF::File.read(MINIMAL_CFF) cff.cff_version = ''