about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authorMatt Jankowski <mjankowski@thoughtbot.com>2017-06-01 08:20:36 -0400
committerGitHub <noreply@github.com>2017-06-01 08:20:36 -0400
commitd1e08bd38c029f0b47dfd2f3ba61ca5bb3e414b8 (patch)
tree2071431a9b9c4acae9b12677ecb03f59b26546c3 /spec
parentdbccdcc1b1e295b7f05a7867936e858ea26f0d6b (diff)
Handle nil and blank cases in Account finders (#3500)
Diffstat (limited to 'spec')
-rw-r--r--spec/models/concerns/account_finder_concern_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/models/concerns/account_finder_concern_spec.rb b/spec/models/concerns/account_finder_concern_spec.rb
index 05f0f44f2..25f4fdec4 100644
--- a/spec/models/concerns/account_finder_concern_spec.rb
+++ b/spec/models/concerns/account_finder_concern_spec.rb
@@ -24,6 +24,14 @@ describe AccountFinderConcern do
       it 'returns nil for regex style username value' do
         expect(Account.find_local('al%')).to be_nil
       end
+
+      it 'returns nil for nil username value' do
+        expect(Account.find_local(nil)).to be_nil
+      end
+
+      it 'returns nil for blank username value' do
+        expect(Account.find_local('')).to be_nil
+      end
     end
 
     describe '.find_local!' do
@@ -70,6 +78,14 @@ describe AccountFinderConcern do
       it 'returns nil for regex style domain value' do
         expect(Account.find_remote('alice', 'm%')).to be_nil
       end
+
+      it 'returns nil for nil username value' do
+        expect(Account.find_remote(nil, 'domain')).to be_nil
+      end
+
+      it 'returns nil for blank username value' do
+        expect(Account.find_remote('', 'domain')).to be_nil
+      end
     end
 
     describe '.find_remote!' do