Module: GovukContentSchemaTestHelpers::TestUnit

Defined in:
lib/govuk-content-schema-test-helpers/test_unit.rb

Instance Method Summary collapse

Instance Method Details

#assert_valid_against_schema(content_item_hash, format) ⇒ Object



3
4
5
6
# File 'lib/govuk-content-schema-test-helpers/test_unit.rb', line 3

def assert_valid_against_schema(content_item_hash, format)
  validator = GovukContentSchemaTestHelpers::Validator.new(format, content_item_hash.to_json)
  assert validator.valid?, "JSON not valid against #{format} schema: #{validator.errors.to_s}"
end