languages_helper_spec.rb 680 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe LanguagesHelper do
  4. describe 'the SUPPORTED_LOCALES constant' do
  5. it 'includes all i18n locales' do
  6. expect(Set.new(described_class::SUPPORTED_LOCALES.keys + described_class::REGIONAL_LOCALE_NAMES.keys)).to include(*I18n.available_locales)
  7. end
  8. end
  9. describe 'native_locale_name' do
  10. it 'finds the human readable native name from a key' do
  11. expect(helper.native_locale_name(:en)).to eq('English')
  12. end
  13. end
  14. describe 'standard_locale_name' do
  15. it 'finds the human readable standard name from a key' do
  16. expect(helper.standard_locale_name(:de)).to eq('German')
  17. end
  18. end
  19. end