-) more rspec tests

-) Bugfixing
This commit is contained in:
Christian Mehlmauer
2012-09-19 21:47:34 +02:00
parent 1684810431
commit 2a46dc3f40
17 changed files with 125 additions and 132 deletions

View File

@@ -39,7 +39,7 @@ module WpUsernames
if response.code == 301 # username in location?
username = response.headers_hash['location'][%r{/author/([^/]+)/}i, 1]
# Get the real name from the redirect site
real_name = get_real_name_from_url(response.headers_hash['location'])
real_name = get_real_name_from_url(url)
elsif response.code == 200 # username in body?
username = response.body[%r{posts by (.*) feed}i, 1]
real_name = get_real_name_from_response(response)
@@ -62,7 +62,7 @@ module WpUsernames
end
def get_real_name_from_url(url)
resp = Browser.instance.get(url, :follow_location => true, :max_redirects => 2)
resp = Browser.instance.get(url, { :follow_location => true, :max_redirects => 2 })
real_name = nil
if resp.code == 200
real_name = extract_real_name_from_body(resp.body)