Ensures a nil location is not processed when enumerating usernames
This commit is contained in:
@@ -22,6 +22,8 @@ class WpUser < WpItem
|
||||
if response.code == 301 # login in location?
|
||||
location = response.headers_hash['Location']
|
||||
|
||||
return unless location
|
||||
|
||||
@login = Existable.login_from_author_pattern(location)
|
||||
@display_name = Existable.display_name_from_body(
|
||||
Browser.get(location).body
|
||||
|
||||
@@ -124,6 +124,15 @@ shared_examples 'WpUser::Existable' do
|
||||
@login = 'admin'
|
||||
@display_name = 'admin name'
|
||||
end
|
||||
|
||||
context 'when the location is nil' do
|
||||
let(:location) { nil }
|
||||
|
||||
it 'returns nil' do
|
||||
@login = nil
|
||||
@display_name = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with a 200' do
|
||||
|
||||
Reference in New Issue
Block a user