Sha256: c0b7657c508f0ac7dd0c4f60326732a78de8f6714cf4517795c2474283714215

Contents?: true

Size: 827 Bytes

Versions: 3

Compression:

Stored size: 827 Bytes

Contents

# frozen_string_literal: true

require "simplecov"

SimpleCov.start

require "minitest/autorun"
require "json_schemer"
require "super_diff"

require "dry/struct"
require "dry/types"
require "dry/types/extensions"

Dry::Types.load_extensions(:json_schema)

module Minitest::Assertions
  def assert_equal_diff(expected, actual, msg = nil)
    assert_equal(expected, actual, msg)
  rescue Minitest::Assertion => e
    puts SuperDiff::Differs::Main.call(expected, actual)
    raise e
  end
end

class Minitest::Spec
  class << self
    def it_conforms_definition(&block)
      instance_exec(&block) if block

      describe "conforms the schema definition" do
        it { assert_equal_diff type.json_schema, definition }
        it { assert JSONSchemer.schema(type.json_schema.to_json).valid_schema? }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-types-json-schema-0.0.4 spec/spec_helper.rb
dry-types-json-schema-0.0.3 spec/spec_helper.rb
dry-types-json-schema-0.0.2 spec/spec_helper.rb