Fix issue with current path query and regexps

This commit is contained in:
Thomas Walpole 2017-11-27 22:35:04 -08:00
parent 53a8f5717e
commit d9fca10413
2 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,7 @@ module Capybara
end
if @expected_path.is_a? Regexp
@actual_path.match(@expected_path)
@actual_path.to_s.match(@expected_path)
else
::Addressable::URI.parse(@expected_path) == ::Addressable::URI.parse(@actual_path)
end

View File

@ -13,6 +13,12 @@ Capybara::SpecHelper.spec '#has_current_path?' do
expect(@session).not_to have_current_path(/monkey/)
end
it "should not raise an error when non-http" do
@session.reset_session!
expect(@session.has_current_path?(/monkey/)).to eq false
expect(@session.has_current_path?("/with_js")).to eq false
end
it "should handle non-escaped query options" do
@session.click_link("Non-escaped query options")
expect(@session).to have_current_path("/with_html?options[]=things")