diff --git a/lib/common/models/wp_user/existable.rb b/lib/common/models/wp_user/existable.rb index b4d2c530..03f7137a 100755 --- a/lib/common/models/wp_user/existable.rb +++ b/lib/common/models/wp_user/existable.rb @@ -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 diff --git a/spec/shared_examples/wp_user/existable.rb b/spec/shared_examples/wp_user/existable.rb index ab0e5058..a09557b0 100644 --- a/spec/shared_examples/wp_user/existable.rb +++ b/spec/shared_examples/wp_user/existable.rb @@ -29,6 +29,13 @@ shared_examples 'WpUser::Existable' do @expected = nil end end + + context 'when no author given' do + it 'returns nil' do + @text = 'See Posts' + @expected = nil + end + end end describe '::login_from_body' do