diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56dd4fe..33f0c0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - ruby: [2.7, 3.0, 3.1, 3.2, 3.3, head, jruby, jruby-head, truffleruby, truffleruby-head] + ruby: [2.7, 3.0, 3.1, 3.2, 3.3, 3.4, head, jruby, jruby-head, truffleruby, truffleruby-head] exclude: - os: ubuntu-latest ruby: head diff --git a/Gemfile.lock b/Gemfile.lock index 34ca0c2..47fe06d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,24 +11,24 @@ GEM remote: https://rubygems.org/ specs: base64 (0.2.0) - bigdecimal (3.1.8) - bigdecimal (3.1.8-java) - concurrent-ruby (1.2.2) - csv (3.2.8) - docile (1.4.0) + bigdecimal (3.1.9) + bigdecimal (3.1.9-java) + concurrent-ruby (1.3.5) + csv (3.3.2) + docile (1.4.1) hana (1.3.7) - i18n (1.14.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) i18n-debug (1.2.0) i18n (< 2) - minitest (5.15.0) - rake (13.1.0) - regexp_parser (2.9.2) + minitest (5.25.4) + rake (13.2.1) + regexp_parser (2.10.0) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) - simplecov-html (0.12.3) + simplecov-html (0.13.1) simplecov_json_formatter (0.1.4) simpleidn (0.2.3) @@ -38,7 +38,7 @@ PLATFORMS DEPENDENCIES base64 - bundler (~> 2.0) + bundler (~> 2.4.0) csv i18n i18n-debug @@ -48,4 +48,4 @@ DEPENDENCIES simplecov (~> 0.22) BUNDLED WITH - 2.3.27 + 2.4.22 diff --git a/json_schemer.gemspec b/json_schemer.gemspec index d905f82..2921d2b 100644 --- a/json_schemer.gemspec +++ b/json_schemer.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.7' spec.add_development_dependency "base64" - spec.add_development_dependency "bundler", "~> 2.0" + spec.add_development_dependency "bundler", "~> 2.4.0" spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "minitest", "~> 5.0" spec.add_development_dependency "simplecov", "~> 0.22" diff --git a/test/configuration_test.rb b/test/configuration_test.rb index a4248bf..401e47f 100644 --- a/test/configuration_test.rb +++ b/test/configuration_test.rb @@ -1,7 +1,7 @@ require 'test_helper' class ConfigurationTest < Minitest::Test - def run_configuration_test(option, default: (skip_default = true), test:) + def run_configuration_test(option, test:, default: (skip_default = true)) original = JSONSchemer.configuration.public_send(option) if default.nil? diff --git a/test/errors_test.rb b/test/errors_test.rb index 38ee7dd..075b10f 100644 --- a/test/errors_test.rb +++ b/test/errors_test.rb @@ -26,13 +26,9 @@ def test_x_error 'a' => 'foo', 'b' => 'bar' } - assert_equal( - [ - 'properties a and b were provided, however only one or the other may be specified', - '{"a"=>"foo", "b"=>"bar"} `` /oneOf/1/not json-schemer://schema#/oneOf/1/not' - ].sort, - JSONSchemer.schema(schema).validate(data).map { |error| error.fetch('error') }.sort - ) + error1, error2 = JSONSchemer.schema(schema).validate(data).map { |error| error.fetch('error') }.sort + assert_equal('properties a and b were provided, however only one or the other may be specified', error1) + assert_match(optional_space_regexp('{"a"', '=>', '"foo", "b"', '=>', '"bar"} `` /oneOf/1/not json-schemer://schema#/oneOf/1/not'), error2) assert_equal('schema error', JSONSchemer.schema(schema).validate(data, :output_format => 'basic').fetch('error')) assert_equal('oneOf error', JSONSchemer.schema(schema).validate(data, :output_format => 'detailed').fetch('error')) @@ -220,7 +216,7 @@ def test_i18n_error end errors.delete('^') - assert_equal('I/9: {"yah"=>1} `` https://example.com/schema#', i18n(errors) { schemer.validate(data, :output_format => 'basic').fetch('error') }) + assert_match(optional_space_regexp('I/9: {"yah"', '=>', '1} `` https://example.com/schema#'), i18n(errors) { schemer.validate(data, :output_format => 'basic').fetch('error') }) errors.delete('type') assert_equal('I/9: 1 `/yah` /properties/yah/type https://example.com/schema#/properties/yah/type', i18n(errors) { schemer.validate(data).first.fetch('error') }) @@ -246,6 +242,10 @@ def test_i18n_error private + def optional_space_regexp(*parts) + /\A#{parts.map { |part| Regexp.escape(part) }.join('\s?')}\z/ + end + def i18n(errors) require 'yaml' require 'i18n'