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

Prefer match? over match when captures not needed

This commit is contained in:
Thomas Walpole 2019-04-19 09:18:13 -07:00
parent a9a38f2db5
commit 555b7b8d63
4 changed files with 4 additions and 4 deletions

View file

@ -22,7 +22,7 @@ module Capybara
@actual_path = options[:url] ? uri&.to_s : uri&.request_uri
if @expected_path.is_a? Regexp
@actual_path.to_s.match(@expected_path)
@actual_path.to_s.match?(@expected_path)
else
::Addressable::URI.parse(@expected_path) == ::Addressable::URI.parse(@actual_path)
end

View file

@ -436,7 +436,7 @@ module Capybara
def matches_text_regexp?(node, regexp)
text_visible = visible
text_visible = :all if text_visible == :hidden
!!node.text(text_visible, normalize_ws: normalize_ws).match(regexp)
node.text(text_visible, normalize_ws: normalize_ws).match?(regexp)
end
def default_visibility

View file

@ -13,7 +13,7 @@ module Capybara
end
def resolves_for?(node)
(@actual_title = node.title).match(@search_regexp)
(@actual_title = node.title).match?(@search_regexp)
end
def failure_message

View file

@ -120,7 +120,7 @@ Capybara.add_selector(:link, locator_type: [String, Symbol]) do
node_filter(:href) do |node, href|
# If not a Regexp it's been handled in the main XPath
(href.is_a?(Regexp) ? node[:href].match(href) : true).tap do |res|
(href.is_a?(Regexp) ? node[:href].match?(href) : true).tap do |res|
add_error "Expected href to match #{href.inspect} but it was #{node[:href].inspect}" unless res
end
end