2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_helper'
|
2013-06-11 11:39:55 -04:00
|
|
|
|
|
|
|
describe LocaleSiteSetting do
|
|
|
|
|
|
|
|
describe 'valid_value?' do
|
|
|
|
it 'returns true for a locale that we have translations for' do
|
|
|
|
expect(LocaleSiteSetting.valid_value?('en')).to eq(true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'returns false for a locale that we do not have translations for' do
|
|
|
|
expect(LocaleSiteSetting.valid_value?('swedish-chef')).to eq(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-06-23 01:07:25 -04:00
|
|
|
describe 'values' do
|
2013-06-11 11:39:55 -04:00
|
|
|
it 'returns all the locales that we have translations for' do
|
2017-07-27 21:20:09 -04:00
|
|
|
expect(LocaleSiteSetting.values.map { |x| x[:value] }.sort).to eq(Dir.glob(File.join(Rails.root, 'config', 'locales', 'client.*.yml')).map { |x| x.split('.')[-2] }.sort)
|
2013-06-11 11:39:55 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|