闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
801 B

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