fix following fully qualified local links
This commit is contained in:
parent
4a898b4223
commit
98d52176ad
@ -54,7 +54,7 @@ module Webrat
|
|||||||
def absolute_href
|
def absolute_href
|
||||||
if href =~ /^\?/
|
if href =~ /^\?/
|
||||||
"#{@session.current_url}#{href}"
|
"#{@session.current_url}#{href}"
|
||||||
elsif href !~ %r{^https?://www.example.com(/.*)} && (href !~ /^\//)
|
elsif href !~ %r{^https?://} && (href !~ /^\//)
|
||||||
"#{@session.current_url}/#{href}"
|
"#{@session.current_url}/#{href}"
|
||||||
else
|
else
|
||||||
href
|
href
|
||||||
|
@ -270,10 +270,11 @@ describe "clicks_link" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "should follow fully qualified local links" do
|
it "should follow fully qualified local links" do
|
||||||
|
@session.stub!(:current_url).and_return("/page")
|
||||||
@session.response_body = <<-EOS
|
@session.response_body = <<-EOS
|
||||||
<a href="http://www.example.com/page/sub">Jump to sub page</a>
|
<a href="http://subdomain.example.com/page/sub">Jump to sub page</a>
|
||||||
EOS
|
EOS
|
||||||
@session.should_receive(:get).with("http://www.example.com/page/sub", {})
|
@session.should_receive(:get).with("http://subdomain.example.com/page/sub", {})
|
||||||
@session.clicks_link "Jump to sub page"
|
@session.clicks_link "Jump to sub page"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user