about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorMatt Jankowski <matt@jankowski.online>2023-03-02 10:21:04 -0500
committerGitHub <noreply@github.com>2023-03-02 16:21:04 +0100
commitaf578e8ce0aabdbe9c0cd3d72d6fa2cc30b7fc66 (patch)
treef913968bf4e4414a674ecfe34e64c037db8a4ff3 /spec
parent9da52ac044ced55213be29119ea25b145039e4d0 (diff)
Fix deprecation warning about merging conditions (#23618)
Diffstat (limited to 'spec')
-rw-r--r--spec/models/account_filter_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/models/account_filter_spec.rb b/spec/models/account_filter_spec.rb
index 853d20a0c..3032260fe 100644
--- a/spec/models/account_filter_spec.rb
+++ b/spec/models/account_filter_spec.rb
@@ -18,4 +18,30 @@ describe AccountFilter do
       expect { filter.results }.to raise_error(/wrong/)
     end
   end
+
+  describe 'with origin and by_domain interacting' do
+    let!(:local_account) { Fabricate(:account, domain: nil) }
+    let!(:remote_account_one) { Fabricate(:account, domain: 'example.org') }
+    let(:remote_account_two) { Fabricate(:account, domain: 'other.domain') }
+
+    it 'works with domain first and origin remote' do
+      filter = described_class.new(by_domain: 'example.org', origin: 'remote')
+      expect(filter.results).to match_array [remote_account_one]
+    end
+
+    it 'works with domain last and origin remote' do
+      filter = described_class.new(origin: 'remote', by_domain: 'example.org')
+      expect(filter.results).to match_array [remote_account_one]
+    end
+
+    it 'works with domain first and origin local' do
+      filter = described_class.new(by_domain: 'example.org', origin: 'local')
+      expect(filter.results).to match_array [local_account]
+    end
+
+    it 'works with domain last and origin local' do
+      filter = described_class.new(origin: 'local', by_domain: 'example.org')
+      expect(filter.results).to match_array [remote_account_one]
+    end
+  end
 end