Require xpath 3.1.0 and remove monkeypatching

This commit is contained in:
Thomas Walpole 2018-05-26 09:18:24 -07:00
parent 522a94a3c4
commit f14a2dd5b4
3 changed files with 1 additions and 27 deletions

View File

@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency("nokogiri", ["~> 1.8"])
s.add_runtime_dependency("rack", [">= 1.6.0"])
s.add_runtime_dependency("rack-test", [">= 0.6.3"])
s.add_runtime_dependency("xpath", ["~>3.0"])
s.add_runtime_dependency("xpath", ["~>3.1"])
s.add_development_dependency("cucumber", [">= 2.3.0"])
s.add_development_dependency("erubi") # dependency specification needed by rbx

View File

@ -2,7 +2,6 @@
require 'capybara/selector/filter_set'
require 'capybara/selector/css'
require 'capybara/selector/xpath'
module Capybara
class Selector

View File

@ -1,25 +0,0 @@
# frozen_string_literal: true
require 'xpath'
# Patch XPath to allow a nil condition in where
module XPath
class Renderer
undef :where if method_defined?(:where)
def where(on, condition)
condition = condition.to_s
if !condition.empty?
"#{on}[#{condition}]"
else
on.to_s
end
end
end
module DSL
def ends_with(suffix)
function(:substring, current, function(:'string-length', current).minus(function(:'string-length', suffix)).plus(1)) == suffix
end
end
end