Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Save spec boot time by lazy-loading i18n-tasks

Christophe Bliard2911ccf4c522
diff --git a/Gemfile b/Gemfile
index 0ac360f4863..688f63221a0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -344,7 +344,7 @@ group :development, :test do
gem "brakeman", "~> 6.1.0"
# i18n-tasks helps find and manage missing and unused translations.
- gem "i18n-tasks", "~> 1.0.13"
+ gem "i18n-tasks", "~> 1.0.13", require: false
end
gem "bootsnap", "~> 1.18.0", require: false
diff --git a/spec/i18n_spec.rb b/spec/i18n_spec.rb
index b921ccc1ec6..acb2500075e 100644
--- a/spec/i18n_spec.rb
+++ b/spec/i18n_spec.rb
@@ -1,8 +1,11 @@
# frozen_string_literal: true
-require "i18n/tasks"
+RSpec.describe "I18n" do
+ before(:all) do # rubocop:disable RSpec/BeforeAfterAll
+ # lazy-load i18n-tasks to save 150ms spec boot time
+ require "i18n/tasks"
+ end
-RSpec.describe I18n do
let(:i18n) { I18n::Tasks::BaseTask.new }
let(:missing_keys) { i18n.missing_keys }
let(:unused_keys) { i18n.unused_keys }