Add support for enum site settings that render as a dropdown; use a dropdown for default_locale

This commit is contained in:
Neil Lalonde
2013-06-11 11:39:55 -04:00
parent c27d5dc2bd
commit 5ff7e570ac
9 changed files with 131 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
require 'spec_helper'
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
describe 'all_values' do
it 'returns all the locales that we have translations for' do
expect(LocaleSiteSetting.all_values.sort).to eq(Dir.glob( File.join(Rails.root, 'config', 'locales', 'client.*.yml') ).map {|x| x.split('.')[-2]}.sort)
end
end
end