about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-10-05 21:48:25 +0200
committerThibaut Girka <thib@sitedethib.com>2018-10-05 21:48:25 +0200
commit98bb6815a774d6101cb0c6c909b4dba7599f2ef8 (patch)
treea6083a4b16dfffcb49ed787a719ddcdb4741cc49 /spec
parentc6e4c489425bd3b66a07d37f39e1678d69226fa8 (diff)
parent144d73730de38da84d605f876157bc9bd45c25b4 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/language_detector_spec.rb10
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