From d1e08bd38c029f0b47dfd2f3ba61ca5bb3e414b8 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Thu, 1 Jun 2017 08:20:36 -0400 Subject: Handle nil and blank cases in Account finders (#3500) --- spec/models/concerns/account_finder_concern_spec.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'spec/models/concerns') 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 -- cgit