1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

minor cleanup

This commit is contained in:
Thomas Walpole 2018-10-16 16:06:50 -07:00
parent b03c934166
commit cc5111119d
2 changed files with 5 additions and 4 deletions

View file

@ -49,8 +49,9 @@ module Capybara
#
def inject_asset_host(html, host: Capybara.asset_host)
if host && Nokogiri::HTML(html).css('base').empty?
match = html.match(/<head[^<]*?>/)
return html.clone.insert match.end(0), "<base href='#{host}' />" if match
html.match(/<head[^<]*?>/) do |m|
return html.clone.insert m.end(0), "<base href='#{host}' />"
end
end
html
end

View file

@ -18,8 +18,8 @@ module Capybara
def resolves_for?(session)
uri = ::Addressable::URI.parse(session.current_url)
uri.query = nil if uri && options[:ignore_query]
@actual_path = options[:url] ? uri.to_s : uri&.request_uri
uri&.query = nil if options[:ignore_query]
@actual_path = options[:url] ? uri&.to_s : uri&.request_uri
if @expected_path.is_a? Regexp
@actual_path.to_s.match(@expected_path)