add all available locales to pages_spec, ensures all custom sites translations are correct, as before it would check only :fr

This commit is contained in:
Jakub Krzus
2021-04-08 18:48:56 +01:00
parent 299a05345d
commit f6fb88028a

View File

@@ -1,6 +1,12 @@
require "rails_helper" require "rails_helper"
describe "Admin custom pages", :admin do describe "Admin custom pages", :admin do
I18n.available_locales = [:ar, :bg, :bs, :ca, :cs, :da, :de, :el, :en, :es, :"es-PE", :eu, :fa, :fr,
:gl, :he, :hr, :id, :it, :ka, :nl, :oc, :pl, :"pt-BR",
:ro, :ru, :sl, :sq, :so, :sr, :sv, :tr, :val, :"zh-CN", :"zh-TW"]
SiteCustomization::Page.destroy_all
Rails.application.load_seed
context "Index" do context "Index" do
scenario "lists all created custom pages" do scenario "lists all created custom pages" do
custom_page = create(:site_customization_page) custom_page = create(:site_customization_page)
@@ -33,15 +39,15 @@ describe "Admin custom pages", :admin do
welcome_not_verified: "welcome.welcome.title", welcome_not_verified: "welcome.welcome.title",
welcome_level_two_verified: "welcome.welcome.title", welcome_level_two_verified: "welcome.welcome.title",
welcome_level_three_verified: "welcome.welcome.title" } welcome_level_three_verified: "welcome.welcome.title" }
locale = :fr I18n.available_locales.each do |locale|
I18n.locale = locale I18n.locale = locale
paths.each do |slug, path| paths.each do |slug, path|
site = SiteCustomization::Page.find_by(slug: slug).translations.find_by(locale: locale) site = SiteCustomization::Page.find_by(slug: slug).translations.find_by(locale: locale)
expect(site.title).to eq I18n.t(path) expect(site.title).to eq I18n.t(path)
end end
end end
end end
end
context "Create" do context "Create" do
scenario "Valid custom page" do scenario "Valid custom page" do