Skip to content

Commit 1ae383b

Browse files
Set languages for test env in to_prepare hook when all other settings are already loaded
1 parent 41105da commit 1ae383b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/hitobito_jubla/wagon.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,14 +141,18 @@ class Wagon < Rails::Engine
141141
Sheet::Group.include Jubla::Sheet::Group
142142
end
143143

144+
# We can't directly override the languages hash in a config file since the hashes are merged
145+
config.to_prepare do
146+
if Rails.env.test?
147+
settings = Settings.to_hash
148+
settings[:application][:languages] = {de: "Deutsch"}
149+
Settings.reload_from_files(settings)
150+
end
151+
end
152+
144153
initializer "jubla.add_settings" do |_app|
145154
Settings.add_source!(File.join(paths["config"].existent, "settings.yml"))
146155
Settings.add_source!(File.join(paths["config"].existent, "settings.local.yml"))
147-
148-
# We can't directly override the hash in a config file since the hashes are merged
149-
settings = Settings.to_hash
150-
settings[:application][:languages] = {de: "Deutsch"}
151-
Settings.add_source!(settings)
152156
Settings.reload!
153157
end
154158

0 commit comments

Comments
 (0)