discourse/spec/models/locale_site_setting_spec.rb
Sam ea932b74e7 values is a much more consistent name than all_values ... we use {}.values not {}.all_values
also fixes random ordering of tests failure in site settings
2013-06-23 15:07:49 +10:00

22 lines
650 B
Ruby

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