logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

localization_spec.rb (878B)


  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe 'Localization' do
  4. after(:all) do
  5. I18n.locale = I18n.default_locale
  6. end
  7. it 'uses a specific region when provided' do
  8. headers = { 'Accept-Language' => 'zh-HK' }
  9. get "/about", headers: headers
  10. expect(response.body).to include(
  11. I18n.t('about.about_mastodon_html', locale: 'zh-HK')
  12. )
  13. end
  14. it 'falls back to a locale when region missing' do
  15. headers = { 'Accept-Language' => 'es-FAKE' }
  16. get "/about", headers: headers
  17. expect(response.body).to include(
  18. I18n.t('about.about_mastodon_html', locale: 'es')
  19. )
  20. end
  21. it 'falls back to english when locale is missing' do
  22. headers = { 'Accept-Language' => '12-FAKE' }
  23. get "/about", headers: headers
  24. expect(response.body).to include(
  25. I18n.t('about.about_mastodon_html', locale: 'en')
  26. )
  27. end
  28. end