diff options
author | Jeong Arm <kjwonmail@gmail.com> | 2018-10-06 02:17:46 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-10-05 19:17:46 +0200 |
commit | 144d73730de38da84d605f876157bc9bd45c25b4 (patch) | |
tree | efea67eaa19a8b4e8e53733310f692415da98789 /spec | |
parent | 9a42b75f00c137f7e9b2e0904adc273dac871daa (diff) |
Leave unknown language as nil if account is remote (#8861)
* Force use language detector if account is remote * Set unknown remote toot's language as nil
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/language_detector_spec.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/lib/language_detector_spec.rb b/spec/lib/language_detector_spec.rb index cdc51a656..0fa2a59ef 100644 --- a/spec/lib/language_detector_spec.rb +++ b/spec/lib/language_detector_spec.rb @@ -42,6 +42,7 @@ describe LanguageDetector do describe 'detect' do let(:account_without_user_locale) { Fabricate(:user, locale: nil).account } + let(:account_remote) { Fabricate(:account, domain: 'joinmastodon.org') } it 'detects english language for basic strings' do strings = [ @@ -104,6 +105,15 @@ describe LanguageDetector do end end + describe 'remote user' do + it 'nil for foreign user when language is not present' do + string = '안녕하세요' + result = described_class.instance.detect(string, account_remote) + + expect(result).to eq nil + end + end + describe 'with a non-`en` default locale' do around(:each) do |example| before = I18n.default_locale |