about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:18:35 +0200
committerOndřej Hruška <ondra@ondrovo.com>2017-09-28 09:18:35 +0200
commit83bda6c1a813c5aeb131b18a0500fed0c07fa9c2 (patch)
tree32f197901b4b16ea7f94de682fee6cdc44686045 /spec/models
parentfcf0d2078ea813e0dd318fa154d620018e7b7bcf (diff)
parentb9f59ebcc68e9da0a7158741a1a2ef3564e1321e (diff)
Merge commit 'b9f59ebcc68e9da0a7158741a1a2ef3564e1321e' into merging-upstream
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/status_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index 12efcae61..9cb71d715 100644
--- a/spec/models/status_spec.rb
+++ b/spec/models/status_spec.rb
@@ -173,6 +173,22 @@ RSpec.describe Status, type: :model do
     end
   end
 
+  describe '.not_in_filtered_languages' do
+    context 'for accounts with language filters' do
+      let(:user) { Fabricate(:user, filtered_languages: ['en']) }
+
+      it 'does not include statuses in filtered languages' do
+        status = Fabricate(:status, language: 'en')
+        expect(Status.not_in_filtered_languages(user.account)).not_to include status
+      end
+
+      it 'includes status with unknown language' do
+        status = Fabricate(:status, language: nil)
+        expect(Status.not_in_filtered_languages(user.account)).to include status
+      end
+    end
+  end
+
   describe '.as_home_timeline' do
     let(:account) { Fabricate(:account) }
     let(:followed) { Fabricate(:account) }