Make sure the paths passed to visit are prefixed with slashes (closes #249)

For Selenium and Celerity.
This commit is contained in:
Jeff Kreeftmeijer 2011-01-19 11:14:23 +01:00
parent a04e0b4d1d
commit 7f10a74853
3 changed files with 7 additions and 0 deletions

View File

@ -158,6 +158,7 @@ class Capybara::Driver::Celerity < Capybara::Driver::Base
private
def url(path)
path = "/#{path}" unless path =~ /^\//
rack_server.url(path)
end

View File

@ -155,6 +155,7 @@ class Capybara::Driver::Selenium < Capybara::Driver::Base
private
def url(path)
path = "/#{path}" unless path =~ /^\//
rack_server.url(path)
end

View File

@ -14,6 +14,11 @@ shared_examples_for 'driver' do
@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