2017-08-07 08:05:13 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-09-10 21:15:06 -05:00
|
|
|
RSpec.describe 'Multisite SiteSettings', type: :multisite do
|
2017-08-07 08:05:13 -05:00
|
|
|
before do
|
|
|
|
@original_provider = SiteSetting.provider
|
|
|
|
SiteSetting.provider = SiteSettings::DbProvider.new(SiteSetting)
|
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
|
|
|
SiteSetting.provider = @original_provider
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '#default_locale' do
|
|
|
|
it 'should return the right locale' do
|
2019-01-09 14:13:02 -06:00
|
|
|
test_multisite_connection('default') do
|
2017-08-07 08:05:13 -05:00
|
|
|
expect(SiteSetting.default_locale).to eq('en')
|
|
|
|
end
|
|
|
|
|
2019-01-09 14:13:02 -06:00
|
|
|
test_multisite_connection('second') do
|
2017-08-07 08:05:13 -05:00
|
|
|
SiteSetting.default_locale = 'zh_TW'
|
|
|
|
|
|
|
|
expect(SiteSetting.default_locale).to eq('zh_TW')
|
|
|
|
end
|
|
|
|
|
2019-01-09 14:13:02 -06:00
|
|
|
test_multisite_connection('default') do
|
2017-08-07 08:05:13 -05:00
|
|
|
expect(SiteSetting.default_locale).to eq('en')
|
|
|
|
|
|
|
|
SiteSetting.default_locale = 'ja'
|
|
|
|
|
|
|
|
expect(SiteSetting.default_locale).to eq('ja')
|
|
|
|
end
|
|
|
|
|
2019-01-09 14:13:02 -06:00
|
|
|
test_multisite_connection('second') do
|
2017-08-07 08:05:13 -05:00
|
|
|
expect(SiteSetting.default_locale).to eq('zh_TW')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|