Prevent flaky specs because of globalize fallbacks initialization
When any helper, lib, mailer, model or view spec is executed after a feature, controller or request spec Globalize.fallbacks returns nil and this can cause some flaky specs. With this patch we are ensuring to initialize Globalize fallbacks between specs. Controller, feature and request specs do not need this patch because of application_controller is currently initializing Globalize.fallback on each request.
This commit is contained in:
committed by
Javi Martín
parent
5eafad81bd
commit
1c76493fa1
@@ -45,6 +45,9 @@ RSpec.configure do |config|
|
||||
DatabaseCleaner.strategy = :transaction
|
||||
I18n.locale = :en
|
||||
Globalize.locale = I18n.locale
|
||||
unless %i[controller feature request].include? example.metadata[:type]
|
||||
Globalize.set_fallbacks_to_all_available_locales
|
||||
end
|
||||
load Rails.root.join("db", "seeds.rb").to_s
|
||||
Setting["feature.user.skip_verification"] = nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user