Sha256: 71b3fc8492231f2ce8e8f3648c7304dae40c69e0a8075c6773fe65c307804711
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
# frozen_string_literal: true begin require 'simplecov' require 'simplecov-console' require 'codecov' rescue LoadError else SimpleCov.start do track_files 'lib/**/*.rb' add_filter '/test' enable_coverage :branch # do not track vendored files add_filter '/vendor' add_filter '/.vendor' end SimpleCov.formatters = [ SimpleCov::Formatter::Console, SimpleCov::Formatter::Codecov, ] end require 'minitest/autorun' require 'webmock/minitest' $LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__)) require 'json-schema' Dir[File.join(File.expand_path('../', __FILE__), '*.rb')].each do |support_file| require support_file unless support_file == __FILE__ end class Minitest::Test def suppress_warnings old_verbose = $VERBOSE $VERBOSE = nil begin yield ensure $VERBOSE = old_verbose end end def schema_fixture_path(filename) File.join(File.dirname(__FILE__), '../schemas', filename) end def data_fixture_path(filename) File.join(File.dirname(__FILE__), '../data', filename) end def assert_valid(schema, data, options = {}, msg = "#{data.inspect} should be valid for schema:\n#{schema.inspect}") errors = validation_errors(schema, data, options) assert_equal([], errors, msg) end def refute_valid(schema, data, options = {}, msg = "#{data.inspect} should be invalid for schema:\n#{schema.inspect}") errors = validation_errors(schema, data, options) refute_equal([], errors, msg) end def validation_errors(schema, data, options) options = { :clear_cache => true, :validate_schema => true }.merge(options) JSON::Validator.fully_validate(schema, data, options) end end
Version data entries
2 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mountapi-0.11.1 | vendor/bundle/ruby/2.7.0/bundler/gems/json-schema-2253a5ee6679/test/support/test_helper.rb |
mountapi-0.11.1 | vendor/json-schema/test/support/test_helper.rb |