mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
minor cleanup
This commit is contained in:
parent
b03c934166
commit
cc5111119d
2 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue