Merge commit 'lawrencepit/banana'

Conflicts:
	spec/api/click_link_spec.rb
This commit is contained in:
Bryan Helmkamp 2008-11-13 22:43:17 -05:00
commit 74dce87c3e
2 changed files with 10 additions and 1 deletions

View File

@ -54,7 +54,7 @@ module Webrat
def absolute_href
if href =~ /^\?/
"#{@session.current_url}#{href}"
elsif href !~ %r{^https?://www.example.com(/.*)} && (href !~ /^\//)
elsif href !~ %r{^https?://} && (href !~ /^\//)
"#{@session.current_url}/#{href}"
else
href

View File

@ -270,6 +270,15 @@ describe "click_link" do
end
it "should follow fully qualified local links" do
@session.stub!(:current_url).and_return("/page")
@session.response_body = <<-EOS
<a href="http://subdomain.example.com/page/sub">Jump to sub page</a>
EOS
@session.should_receive(:get).with("http://subdomain.example.com/page/sub", {})
@session.click_link "Jump to sub page"
end
it "should follow fully qualified local links to example.com" do
@session.response_body = <<-EOS
<a href="http://www.example.com/page/sub">Jump to sub page</a>
EOS