Fixes incorrect detection of the username
This commit is contained in:
@@ -39,7 +39,7 @@ class WpUser < WpItem
|
||||
#
|
||||
# @return [ String ] The login
|
||||
def self.login_from_author_pattern(text)
|
||||
return unless text =~ %r{/author/([^/\b]+)/?}i
|
||||
return unless text =~ %r{/author/([^/\b"']+)/?}i
|
||||
|
||||
Regexp.last_match[1].force_encoding('UTF-8')
|
||||
end
|
||||
|
||||
@@ -29,6 +29,13 @@ shared_examples 'WpUser::Existable' do
|
||||
@expected = nil
|
||||
end
|
||||
end
|
||||
|
||||
context 'when no author given' do
|
||||
it 'returns nil' do
|
||||
@text = '<a href="http://wp.lab/author/" class="btn btn-default">See Posts</a>'
|
||||
@expected = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '::login_from_body' do
|
||||
|
||||
Reference in New Issue
Block a user