diff --git a/lib/open_food_network/i18n_config.rb b/lib/open_food_network/i18n_config.rb index 73ab508315..8ef0b3e563 100644 --- a/lib/open_food_network/i18n_config.rb +++ b/lib/open_food_network/i18n_config.rb @@ -4,7 +4,7 @@ module OpenFoodNetwork # See: config/application.yml class I18nConfig def self.selectable_locales - ENV["AVAILABLE_LOCALES"].andand.split(/[\s,]/).andand.map(&:strip) || [] + ENV["AVAILABLE_LOCALES"].andand.split(/[\s,]+/) || [] end def self.available_locales diff --git a/spec/lib/open_food_network/i18n_config_spec.rb b/spec/lib/open_food_network/i18n_config_spec.rb index ac056ab921..306566b5e8 100644 --- a/spec/lib/open_food_network/i18n_config_spec.rb +++ b/spec/lib/open_food_network/i18n_config_spec.rb @@ -77,17 +77,15 @@ module OpenFoodNetwork context "with human syntax" do before do allow(ENV).to receive(:[]).with("LOCALE").and_return("es") - allow(ENV).to receive(:[]).with("AVAILABLE_LOCALES").and_return("es, fr") + allow(ENV).to receive(:[]).with("AVAILABLE_LOCALES").and_return("es, fr ,, ,de") end - xit "provides the default selectable locales" do - # current: expect(I18nConfig.selectable_locales).to eq ["es", "", "fr"] - expect(I18nConfig.selectable_locales).to eq ["es", "fr"] + it "provides the default selectable locales" do + expect(I18nConfig.selectable_locales).to eq ["es", "fr", "de"] end - xit "provides the default available locales" do - # current: expect(I18nConfig.available_locales).to eq ["es", "", "fr", "en"] - expect(I18nConfig.available_locales).to eq ["es", "fr", "en"] + it "provides the default available locales" do + expect(I18nConfig.available_locales).to eq ["es", "fr", "de", "en"] end end end