2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-09-10 22:15:06 -04:00
|
|
|
RSpec.describe "Multisite SiteSettings", type: :multisite do
|
2017-08-07 09:05:13 -04:00
|
|
|
before do
|
|
|
|
@original_provider = SiteSetting.provider
|
|
|
|
SiteSetting.provider = SiteSettings::DbProvider.new(SiteSetting)
|
|
|
|
end
|
|
|
|
|
|
|
|
after { SiteSetting.provider = @original_provider }
|
|
|
|
|
|
|
|
describe "#default_locale" do
|
|
|
|
it "should return the right locale" do
|
2021-01-20 15:32:22 -05:00
|
|
|
test_multisite_connection("default") { expect(SiteSetting.default_locale).to eq("en") }
|
2017-08-07 09:05:13 -04:00
|
|
|
|
2019-01-09 15:13:02 -05:00
|
|
|
test_multisite_connection("second") do
|
2017-08-07 09:05:13 -04:00
|
|
|
SiteSetting.default_locale = "zh_TW"
|
|
|
|
|
|
|
|
expect(SiteSetting.default_locale).to eq("zh_TW")
|
|
|
|
end
|
|
|
|
|
2019-01-09 15:13:02 -05:00
|
|
|
test_multisite_connection("default") do
|
2021-01-20 15:32:22 -05:00
|
|
|
expect(SiteSetting.default_locale).to eq("en")
|
2017-08-07 09:05:13 -04:00
|
|
|
|
|
|
|
SiteSetting.default_locale = "ja"
|
|
|
|
|
|
|
|
expect(SiteSetting.default_locale).to eq("ja")
|
|
|
|
end
|
|
|
|
|
|
|
|
test_multisite_connection("second") { expect(SiteSetting.default_locale).to eq("zh_TW") }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|