Skip to content

Commit

Permalink
Ruby 3.4
Browse files Browse the repository at this point in the history
- Stay on Bundler 2.4 for Ruby 2.7 support
- Upgrade gems to get around default/bundled gems errors (eg,
  `'Kernel#require': cannot load such file -- mutex_m (LoadError)` from
  minitest)
- Change keyword argument order for JRuby: jruby/jruby#8577
- Hack around `Hash#inspect` [changes][0] (space around `=>`) in tests

[0]: https://rubyreferences.github.io/rubychanges/3.4.html#inspect-rendering-have-been-changed
  • Loading branch information
davishmcclurg committed Jan 19, 2025
1 parent 2a239b6 commit 694c001
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 12 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -38,7 +38,7 @@ PLATFORMS

DEPENDENCIES
base64
bundler (~> 2.0)
bundler (~> 2.4.0)
csv
i18n
i18n-debug
Expand All @@ -48,4 +48,4 @@ DEPENDENCIES
simplecov (~> 0.22)

BUNDLED WITH
2.3.27
2.4.22
2 changes: 1 addition & 1 deletion json_schemer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/configuration_test.rb
Original file line number Diff line number Diff line change
@@ -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?
Expand Down
16 changes: 8 additions & 8 deletions test/errors_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down Expand Up @@ -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') })
Expand All @@ -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'
Expand Down

0 comments on commit 694c001

Please sign in to comment.