mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Require xpath 3.1.0 and remove monkeypatching
This commit is contained in:
parent
522a94a3c4
commit
f14a2dd5b4
3 changed files with 1 additions and 27 deletions
|
@ -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
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
require 'capybara/selector/filter_set'
|
||||
require 'capybara/selector/css'
|
||||
require 'capybara/selector/xpath'
|
||||
|
||||
module Capybara
|
||||
class Selector
|
||||
|
|
|
@ -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
|
Loading…
Reference in a new issue