Skip to content

Commit

Permalink
Merge commit 'lawrencepit/banana'
Browse files Browse the repository at this point in the history
Conflicts:
	spec/api/click_link_spec.rb
  • Loading branch information
brynary committed Nov 14, 2008
2 parents e8c9f04 + 98d5217 commit 74dce87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webrat/core/link.rb
Expand Up @@ -54,7 +54,7 @@ def href
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
Expand Down
9 changes: 9 additions & 0 deletions spec/api/click_link_spec.rb
Expand Up @@ -270,6 +270,15 @@
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
Expand Down

0 comments on commit 74dce87

Please sign in to comment.