remove redundant begin/end

This commit is contained in:
Thomas Walpole 2018-05-30 16:19:12 -07:00
parent b01a2ce417
commit f07af14d3a
2 changed files with 4 additions and 6 deletions

View File

@ -7,11 +7,9 @@ module Capybara
module Filters
class NodeFilter < Base
def matches?(node, name, value)
begin
apply(node, name, value, true)
rescue Capybara::ElementNotFound
false
end
apply(node, name, value, true)
rescue Capybara::ElementNotFound
false
end
end
end

View File

@ -128,7 +128,7 @@ Capybara::SpecHelper.spec '#find' do
Capybara.add_selector(:beatle) do
xpath { |name| ".//li[contains(@class, 'beatle')][contains(text(), '#{name}')]" }
node_filter(:type) { |node, type| node[:class].split(/\s+/).include?(type) }
node_filter(:fail) { |node, val| raise Capybara::ElementNotFound, 'fail' }
node_filter(:fail) { |_node, _val| raise Capybara::ElementNotFound, 'fail' }
end
end