Skip to content

Commit

Permalink
Make sure the paths passed to visit are prefixed with slashes (closes #…
Browse files Browse the repository at this point in the history
…249)

For Selenium and Celerity.
  • Loading branch information
Jeff Kreeftmeijer committed Jan 19, 2011
1 parent a04e0b4 commit 7f10a74
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/capybara/driver/celerity_driver.rb
Expand Up @@ -158,6 +158,7 @@ def reset!
private

def url(path)
path = "/#{path}" unless path =~ /^\//
rack_server.url(path)
end

Expand Down
1 change: 1 addition & 0 deletions lib/capybara/driver/selenium_driver.rb
Expand Up @@ -155,6 +155,7 @@ def within_window(handle, &blk)
private

def url(path)
path = "/#{path}" unless path =~ /^\//
rack_server.url(path)
end

Expand Down
5 changes: 5 additions & 0 deletions lib/capybara/spec/driver.rb
Expand Up @@ -14,6 +14,11 @@
@driver.visit('/foo')
@driver.current_url.should include('/foo')
end

it "should prefix paths with slashes to make sure the url is valid" do
@driver.visit('foo')
@driver.current_url.should include('/foo')
end
end

describe '#body' do
Expand Down

0 comments on commit 7f10a74

Please sign in to comment.