Do not exclude spec_helper.rb from Rails/I18nLocaleAssignment cop

Use the around action to set the desired locale so we do not break the rule.
This commit is contained in:
Senén Rodero Rodríguez
2021-09-03 13:11:30 +02:00
parent 9938ab0017
commit 64278c663c
2 changed files with 6 additions and 3 deletions

View File

@@ -269,8 +269,6 @@ Rails/HttpStatus:
Rails/I18nLocaleAssignment: Rails/I18nLocaleAssignment:
Enabled: true Enabled: true
Exclude:
- "spec/spec_helper.rb"
Rails/InverseOf: Rails/InverseOf:
Enabled: true Enabled: true

View File

@@ -30,11 +30,16 @@ RSpec.configure do |config|
end end
config.before do |example| config.before do |example|
I18n.locale = :en
Globalize.set_fallbacks_to_all_available_locales Globalize.set_fallbacks_to_all_available_locales
Setting["feature.user.skip_verification"] = nil Setting["feature.user.skip_verification"] = nil
end end
config.around do |example|
I18n.with_locale(:en) do
example.run
end
end
config.around(:each, :race_condition) do |example| config.around(:each, :race_condition) do |example|
self.use_transactional_tests = false self.use_transactional_tests = false
example.run example.run