about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>2017-09-23 02:33:17 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-09-22 19:33:17 +0200
commit0de82dd316839ed329504bfbf9bd0f2d3d96e654 (patch)
treef9baedb5c355ccc3ed955851a1eb5605662c4f51 /spec
parentdcfc9b220462533c8bcdebc7ca25a68fa23aaf5f (diff)
Do not filter statuses with unknown languages (#5045)
Diffstat (limited to 'spec')
-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) }