From 7e27159f535643bc3080dce132a5ae953c4034ea Mon Sep 17 00:00:00 2001 From: Nando Vieira Date: Thu, 29 Feb 2024 16:45:03 -0800 Subject: [PATCH] Require ruby 3.2+. --- .github/workflows/ruby-tests.yml | 4 +-- .rubocop.yml | 2 +- i18n-js.gemspec | 4 +-- lib/i18n-js.rb | 7 ++-- lib/i18n-js/cli.rb | 4 +-- lib/i18n-js/cli/export_command.rb | 6 ++-- lib/i18n-js/cli/lint_scripts_command.rb | 4 +-- lib/i18n-js/cli/lint_translations_command.rb | 2 +- lib/i18n-js/export_files_plugin.rb | 14 ++++---- lib/i18n-js/listen.rb | 2 +- lib/i18n-js/plugin.rb | 2 +- lib/i18n-js/schema.rb | 18 +++++----- test/i18n-js/cli/check_command_test.rb | 36 +++++++++---------- test/i18n-js/cli/export_command_test.rb | 32 ++++++++--------- test/i18n-js/cli/init_command_test.rb | 20 +++++------ test/i18n-js/cli/lint_scripts_command_test.rb | 28 +++++++-------- .../cli/lint_translations_command_test.rb | 36 +++++++++---------- test/i18n-js/cli/plugins_command_test.rb | 20 +++++------ test/i18n-js/cli/root_command_test.rb | 2 +- test/i18n-js/cli/version_command_test.rb | 4 +-- test/i18n-js/exporter_test.rb | 4 +-- test/i18n-js/plugin_test.rb | 6 ++-- test/i18n-js/schema_test.rb | 2 +- test/test_helper.rb | 2 +- 24 files changed, 130 insertions(+), 131 deletions(-) diff --git a/.github/workflows/ruby-tests.yml b/.github/workflows/ruby-tests.yml index 8b894407..570895e1 100644 --- a/.github/workflows/ruby-tests.yml +++ b/.github/workflows/ruby-tests.yml @@ -16,8 +16,8 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.7", "3.0", "3.1"] - node: ["16", "18"] + ruby: ["3.2", "3.3"] + node: ["18", "20"] gemfile: - Gemfile if: | diff --git a/.rubocop.yml b/.rubocop.yml index 7928cb15..62b3a572 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,7 @@ inherit_gem: rubocop-fnando: .rubocop.yml AllCops: - TargetRubyVersion: 2.6 + TargetRubyVersion: 3.2 NewCops: enable Exclude: - tmp/**/* diff --git a/i18n-js.gemspec b/i18n-js.gemspec index c9bdcea0..d23d1ff9 100644 --- a/i18n-js.gemspec +++ b/i18n-js.gemspec @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative "./lib/i18n-js/version" +require_relative "lib/i18n-js/version" Gem::Specification.new do |spec| spec.name = "i18n-js" @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.summary = "Export i18n translations and use them on JavaScript." spec.description = spec.summary spec.license = "MIT" - spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0") + spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0") spec.metadata = {"rubygems_mfa_required" => "true"} github_url = "https://github.com/fnando/i18n-js" diff --git a/lib/i18n-js.rb b/lib/i18n-js.rb index af33430e..e2f453eb 100644 --- a/lib/i18n-js.rb +++ b/lib/i18n-js.rb @@ -7,7 +7,6 @@ require "fileutils" require "optparse" require "erb" -require "set" require "digest/md5" require_relative "i18n-js/schema" @@ -28,7 +27,7 @@ def self.call(config_file: nil, config: nil) config = Glob::SymbolizeKeys.call(config || load_config_file(config_file)) load_plugins! - initialize_plugins!(config: config) + initialize_plugins!(config:) Schema.validate!(config) exported_files = [] @@ -59,7 +58,7 @@ def self.export_group(group) if output_file_path.include?(":locale") filtered_translations.each_key do |locale| - locale_file_path = output_file_path.gsub(/:locale/, locale.to_s) + locale_file_path = output_file_path.gsub(":locale", locale.to_s) exported_files << write_file(locale_file_path, locale => filtered_translations[locale]) end @@ -75,7 +74,7 @@ def self.write_file(file_path, translations) contents = ::JSON.pretty_generate(translations) digest = Digest::MD5.hexdigest(contents) - file_path = file_path.gsub(/:digest/, digest) + file_path = file_path.gsub(":digest", digest) # Don't rewrite the file if it already exists and has the same content. # It helps the asset pipeline or webpack understand that file wasn't diff --git a/lib/i18n-js/cli.rb b/lib/i18n-js/cli.rb index 65dc9bfa..9e9b48e4 100644 --- a/lib/i18n-js/cli.rb +++ b/lib/i18n-js/cli.rb @@ -17,7 +17,7 @@ class CLI def initialize(argv:, stdout:, stderr:, colored: stdout.tty?) @argv = argv.dup - @ui = UI.new(stdout: stdout, stderr: stderr, colored: colored) + @ui = UI.new(stdout:, stderr:, colored:) end def call @@ -43,7 +43,7 @@ def call private def commands command_classes.map do |command_class| - command_class.new(argv: @argv, ui: ui) + command_class.new(argv: @argv, ui:) end end diff --git a/lib/i18n-js/cli/export_command.rb b/lib/i18n-js/cli/export_command.rb index b3cb48ab..7e3cfa75 100644 --- a/lib/i18n-js/cli/export_command.rb +++ b/lib/i18n-js/cli/export_command.rb @@ -71,16 +71,16 @@ class ExportCommand < Command time = Benchmark.realtime do load_require_file!(require_file) if require_file - I18nJS.call(config_file: config_file) + I18nJS.call(config_file:) end log("=> Done in #{time.round(2)}s") end - private def log(*args) + private def log(*) return if options[:quiet] - ui.stdout_print(*args) + ui.stdout_print(*) end private def set_defaults! diff --git a/lib/i18n-js/cli/lint_scripts_command.rb b/lib/i18n-js/cli/lint_scripts_command.rb index 86137bc3..232e4d57 100644 --- a/lib/i18n-js/cli/lint_scripts_command.rb +++ b/lib/i18n-js/cli/lint_scripts_command.rb @@ -81,7 +81,7 @@ class LintScriptsCommand < Command config = load_config_file(config_file) I18nJS.load_plugins! - I18nJS.initialize_plugins!(config: config) + I18nJS.initialize_plugins!(config:) Schema.validate!(config) load_require_file!(require_file) if require_file @@ -91,7 +91,7 @@ class LintScriptsCommand < Command ui.stdout_print "=> Available locales: #{available_locales.inspect}" - exported_files = I18nJS.call(config_file: config_file) + exported_files = I18nJS.call(config_file:) data = exported_files.each_with_object({}) do |file, buffer| buffer.merge!(JSON.load_file(file, symbolize_names: true)) end diff --git a/lib/i18n-js/cli/lint_translations_command.rb b/lib/i18n-js/cli/lint_translations_command.rb index ec82ea4c..fd142439 100644 --- a/lib/i18n-js/cli/lint_translations_command.rb +++ b/lib/i18n-js/cli/lint_translations_command.rb @@ -69,7 +69,7 @@ class LintTranslationsCommand < Command config = load_config_file(config_file) I18nJS.load_plugins! - I18nJS.initialize_plugins!(config: config) + I18nJS.initialize_plugins!(config:) Schema.validate!(config) load_require_file!(require_file) if require_file diff --git a/lib/i18n-js/export_files_plugin.rb b/lib/i18n-js/export_files_plugin.rb index d6234319..421236e6 100644 --- a/lib/i18n-js/export_files_plugin.rb +++ b/lib/i18n-js/export_files_plugin.rb @@ -54,8 +54,8 @@ def after_export(files:) config[:files].each do |export| translations = JSON.load_file(file) template = Template.new( - file: file, - translations: translations, + file:, + translations:, template: export[:template] ) @@ -63,11 +63,11 @@ def after_export(files:) output = format( export[:output], - dir: dir, - name: name, - extension: extension, + dir:, + name:, + extension:, digest: Digest::MD5.hexdigest(contents), - base_name: base_name + base_name: ) File.open(output, "w") do |io| @@ -82,7 +82,7 @@ class Template def initialize(**kwargs) kwargs.each do |key, value| - public_send("#{key}=", value) + public_send(:"#{key}=", value) end end diff --git a/lib/i18n-js/listen.rb b/lib/i18n-js/listen.rb index 7ea46b33..9d922821 100644 --- a/lib/i18n-js/listen.rb +++ b/lib/i18n-js/listen.rb @@ -28,7 +28,7 @@ def self.listen( debug("Watching #{relative_paths.inspect}") listener(config_file, locales_dirs.map(&:to_s), options).start - I18nJS.call(config_file: config_file) if run_on_start + I18nJS.call(config_file:) if run_on_start end def self.relative_path(path) diff --git a/lib/i18n-js/plugin.rb b/lib/i18n-js/plugin.rb index 22fb0b42..51add2b6 100644 --- a/lib/i18n-js/plugin.rb +++ b/lib/i18n-js/plugin.rb @@ -27,7 +27,7 @@ def self.load_plugins! def self.initialize_plugins!(config:) @plugins = available_plugins.map do |plugin| - plugin.new(config: config).tap(&:setup) + plugin.new(config:).tap(&:setup) end end diff --git a/lib/i18n-js/schema.rb b/lib/i18n-js/schema.rb index 638081e7..42b680c6 100644 --- a/lib/i18n-js/schema.rb +++ b/lib/i18n-js/schema.rb @@ -133,8 +133,8 @@ def reject(error_message, node = nil) end def expect_type(path:, types:) - path = prepare_path(path: path) - value = value_for(path: path) + path = prepare_path(path:) + value = value_for(path:) types = Array(types) return if types.any? {|type| value.is_a?(type) } @@ -156,10 +156,10 @@ def expect_type(path:, types:) end def expect_array_with_items(path:) - expect_type(path: path, types: Array) + expect_type(path:, types: Array) - path = prepare_path(path: path) - value = value_for(path: path) + path = prepare_path(path:) + value = value_for(path:) return unless value.empty? @@ -168,8 +168,8 @@ def expect_array_with_items(path:) end def expect_required_keys(keys:, path:) - path = prepare_path(path: path) - value = value_for(path: path) + path = prepare_path(path:) + value = value_for(path:) actual_keys = value.keys.map(&:to_sym) keys.each do |key| @@ -186,8 +186,8 @@ def expect_required_keys(keys:, path:) end def reject_extraneous_keys(keys:, path:) - path = prepare_path(path: path) - value = value_for(path: path) + path = prepare_path(path:) + value = value_for(path:) actual_keys = value.keys.map(&:to_sym) extraneous = actual_keys.to_a - keys.to_a diff --git a/test/i18n-js/cli/check_command_test.rb b/test/i18n-js/cli/check_command_test.rb index ee3b33cb..ca393def 100644 --- a/test/i18n-js/cli/check_command_test.rb +++ b/test/i18n-js/cli/check_command_test.rb @@ -9,8 +9,8 @@ class CheckCommandTest < Minitest::Test test "displays help" do cli = I18nJS::CLI.new( argv: %w[check --help], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -20,8 +20,8 @@ class CheckCommandTest < Minitest::Test test "without a config file" do cli = I18nJS::CLI.new( argv: %w[check], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -35,8 +35,8 @@ class CheckCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %W[check --config #{config_file}], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -54,8 +54,8 @@ class CheckCommandTest < Minitest::Test --config test/config/everything.yml --require #{require_file} ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -68,8 +68,8 @@ class CheckCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %w[check --config test/config/everything.yml], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -85,8 +85,8 @@ class CheckCommandTest < Minitest::Test --config test/config/everything.yml --require test/config/require_error.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -105,8 +105,8 @@ class CheckCommandTest < Minitest::Test --require test/config/require.rb --color ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -125,8 +125,8 @@ class CheckCommandTest < Minitest::Test --config test/config/everything.yml --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -150,8 +150,8 @@ class CheckCommandTest < Minitest::Test --config test/config/check.yml --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } diff --git a/test/i18n-js/cli/export_command_test.rb b/test/i18n-js/cli/export_command_test.rb index d2f796d9..06b7594c 100644 --- a/test/i18n-js/cli/export_command_test.rb +++ b/test/i18n-js/cli/export_command_test.rb @@ -9,8 +9,8 @@ class ExportCommandTest < Minitest::Test test "displays help" do cli = I18nJS::CLI.new( argv: %w[export --help], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -20,8 +20,8 @@ class ExportCommandTest < Minitest::Test test "without a config file" do cli = I18nJS::CLI.new( argv: %w[export], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -34,8 +34,8 @@ class ExportCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %W[export --config #{config_file}], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -52,8 +52,8 @@ class ExportCommandTest < Minitest::Test --config test/config/everything.yml --require #{require_file} ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -65,8 +65,8 @@ class ExportCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %w[export --config test/config/everything.yml], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -85,8 +85,8 @@ class ExportCommandTest < Minitest::Test --config test/config/everything.yml --require test/config/require_error.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -103,8 +103,8 @@ class ExportCommandTest < Minitest::Test --config test/config/everything.yml --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -122,8 +122,8 @@ class ExportCommandTest < Minitest::Test --require test/config/require.rb --quiet ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } diff --git a/test/i18n-js/cli/init_command_test.rb b/test/i18n-js/cli/init_command_test.rb index a9dd91bf..7e60c592 100644 --- a/test/i18n-js/cli/init_command_test.rb +++ b/test/i18n-js/cli/init_command_test.rb @@ -9,8 +9,8 @@ class InitCommandTest < Minitest::Test test "displays help" do cli = I18nJS::CLI.new( argv: %w[init --help], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -23,8 +23,8 @@ class InitCommandTest < Minitest::Test Dir.chdir("test/output") do cli = I18nJS::CLI.new( argv: %w[init], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -37,8 +37,8 @@ class InitCommandTest < Minitest::Test test "initializes project" do cli = I18nJS::CLI.new( argv: %w[init --config test/output/i18n.yml], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -51,16 +51,16 @@ class InitCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %W[init --config #{config_file}], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } cli = I18nJS::CLI.new( argv: %W[init --config #{config_file}], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } diff --git a/test/i18n-js/cli/lint_scripts_command_test.rb b/test/i18n-js/cli/lint_scripts_command_test.rb index 20c79736..0cde3056 100644 --- a/test/i18n-js/cli/lint_scripts_command_test.rb +++ b/test/i18n-js/cli/lint_scripts_command_test.rb @@ -9,8 +9,8 @@ class LintCommandTest < Minitest::Test test "displays help" do cli = I18nJS::CLI.new( argv: %w[lint:scripts --help], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -20,8 +20,8 @@ class LintCommandTest < Minitest::Test test "without a config file" do cli = I18nJS::CLI.new( argv: %w[lint:scripts], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -34,8 +34,8 @@ class LintCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %W[lint:scripts --config #{config_file}], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -52,8 +52,8 @@ class LintCommandTest < Minitest::Test --config test/config/lint_scripts.yml --require #{require_file} ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -68,8 +68,8 @@ class LintCommandTest < Minitest::Test --require test/config/require.rb --node-path /invalid/path/to/node ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -86,8 +86,8 @@ class LintCommandTest < Minitest::Test --config test/config/lint_scripts.yml --require test/config/require_error.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -104,8 +104,8 @@ class LintCommandTest < Minitest::Test --config test/config/lint_scripts.yml --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(8) { cli.call } diff --git a/test/i18n-js/cli/lint_translations_command_test.rb b/test/i18n-js/cli/lint_translations_command_test.rb index abd870f2..0d8f8272 100644 --- a/test/i18n-js/cli/lint_translations_command_test.rb +++ b/test/i18n-js/cli/lint_translations_command_test.rb @@ -9,8 +9,8 @@ class LintTranslationsCommandTest < Minitest::Test test "displays help" do cli = I18nJS::CLI.new( argv: %w[lint:translations --help], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -20,8 +20,8 @@ class LintTranslationsCommandTest < Minitest::Test test "without a config file" do cli = I18nJS::CLI.new( argv: %w[lint:translations], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -34,8 +34,8 @@ class LintTranslationsCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %W[lint:translations --config #{config_file}], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -52,8 +52,8 @@ class LintTranslationsCommandTest < Minitest::Test --config test/config/everything.yml --require #{require_file} ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -65,8 +65,8 @@ class LintTranslationsCommandTest < Minitest::Test cli = I18nJS::CLI.new( argv: %w[lint:translations --config test/config/everything.yml], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -81,8 +81,8 @@ class LintTranslationsCommandTest < Minitest::Test --config test/config/everything.yml --require test/config/require_error.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -100,8 +100,8 @@ class LintTranslationsCommandTest < Minitest::Test --require test/config/require.rb --color ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -119,8 +119,8 @@ class LintTranslationsCommandTest < Minitest::Test --config test/config/everything.yml --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -143,8 +143,8 @@ class LintTranslationsCommandTest < Minitest::Test --config test/config/lint_translations.yml --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } diff --git a/test/i18n-js/cli/plugins_command_test.rb b/test/i18n-js/cli/plugins_command_test.rb index 9e3fd397..e847d27a 100644 --- a/test/i18n-js/cli/plugins_command_test.rb +++ b/test/i18n-js/cli/plugins_command_test.rb @@ -9,8 +9,8 @@ class PluginsCommandTest < Minitest::Test test "displays help" do cli = I18nJS::CLI.new( argv: %w[plugins --help], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } @@ -26,8 +26,8 @@ class PluginsCommandTest < Minitest::Test plugins --require #{require_file} ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -40,8 +40,8 @@ class PluginsCommandTest < Minitest::Test plugins --require test/config/require_error.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -59,8 +59,8 @@ class PluginsCommandTest < Minitest::Test plugins --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } @@ -78,8 +78,8 @@ class PluginsCommandTest < Minitest::Test plugins --require test/config/require.rb ], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(1) { cli.call } diff --git a/test/i18n-js/cli/root_command_test.rb b/test/i18n-js/cli/root_command_test.rb index 996fb0c1..42e3c689 100644 --- a/test/i18n-js/cli/root_command_test.rb +++ b/test/i18n-js/cli/root_command_test.rb @@ -7,7 +7,7 @@ class RootCommandTest < Minitest::Test let(:stderr) { StringIO.new } test "shows help on root" do - cli = I18nJS::CLI.new(argv: [], stdout: stdout, stderr: stderr) + cli = I18nJS::CLI.new(argv: [], stdout:, stderr:) assert_exit_code(1) { cli.call } assert_includes stderr.tap(&:rewind).read, "Usage: i18n COMMAND FLAGS" diff --git a/test/i18n-js/cli/version_command_test.rb b/test/i18n-js/cli/version_command_test.rb index 51f275f0..35b9c09b 100644 --- a/test/i18n-js/cli/version_command_test.rb +++ b/test/i18n-js/cli/version_command_test.rb @@ -9,8 +9,8 @@ class VersionCommandTest < Minitest::Test test "displays version" do cli = I18nJS::CLI.new( argv: %w[version], - stdout: stdout, - stderr: stderr + stdout:, + stderr: ) assert_exit_code(0) { cli.call } diff --git a/test/i18n-js/exporter_test.rb b/test/i18n-js/exporter_test.rb index 79893024..f49ea690 100644 --- a/test/i18n-js/exporter_test.rb +++ b/test/i18n-js/exporter_test.rb @@ -183,7 +183,7 @@ def transform(translations:) ) I18nJS.register_plugin(plugin_class) I18n.load_path << Dir["./test/fixtures/yml/*.yml"] - I18nJS.call(config: config) + I18nJS.call(config:) assert_json_file "test/fixtures/expected/transformed.json", "test/output/everything.json" @@ -231,7 +231,7 @@ def transform(translations:) exported_file_path # mtime should be newer - assert File.mtime(exported_file_path) > exported_file_mtime + assert_operator File.mtime(exported_file_path), :>, exported_file_mtime end test "cleans hash when exporting files" do diff --git a/test/i18n-js/plugin_test.rb b/test/i18n-js/plugin_test.rb index 9f95e2d3..c9f0ff22 100644 --- a/test/i18n-js/plugin_test.rb +++ b/test/i18n-js/plugin_test.rb @@ -23,7 +23,7 @@ def self.calls translations = {} assert_same translations, - plugin.transform(translations: translations) + plugin.transform(translations:) end test "registers plugin" do @@ -72,7 +72,7 @@ def validate_schema end I18nJS.register_plugin(plugin_class) - I18nJS.initialize_plugins!(config: config) + I18nJS.initialize_plugins!(config:) I18nJS::Schema.validate!(config) assert_equal 1, plugin_class.calls.size @@ -109,7 +109,7 @@ def after_export(files:) I18nJS.register_plugin(plugin_class) actual_files = - I18nJS.call(config: config) + I18nJS.call(config:) assert_exported_files expected_files, actual_files assert_exported_files expected_files, plugin_class.received_files diff --git a/test/i18n-js/schema_test.rb b/test/i18n-js/schema_test.rb index e67738de..62ef7cf2 100644 --- a/test/i18n-js/schema_test.rb +++ b/test/i18n-js/schema_test.rb @@ -196,7 +196,7 @@ def setup end I18nJS.register_plugin(plugin_class) - I18nJS.initialize_plugins!(config: config) + I18nJS.initialize_plugins!(config:) error_message = "Expected \"sample.enabled\" to be one of [TrueClass, FalseClass]; " \ diff --git a/test/test_helper.rb b/test/test_helper.rb index e16acccf..d1e1b5dd 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -14,6 +14,6 @@ require "minitest/utils" require "minitest/autorun" -Dir["./test/support/**/*.rb"].sort.each do |file| +Dir["./test/support/**/*.rb"].each do |file| require file end