Monkeypatch webrat for Nokogiri compatibility

This is an attempt to address the Webrat / Nokogiri compatibility issue
[discussed here]. It monkeypatches Webrat to explicitly add the old
default arguments to the invocation of to_xpath.

Move monkey patch to its own file under test/support/webrat.
I really need to get rid of webrat.

Closes #5475

[discussed here] https://github.com/sparklemotion/nokogiri/issues/2469
This commit is contained in:
Peter Goldstein
2022-02-25 11:30:57 -08:00
committed by Carlos Antonio da Silva
parent ee8f0f8e83
commit 90f46bac37
9 changed files with 15 additions and 11 deletions

View File

@@ -14,7 +14,6 @@ gem "rails-controller-testing", github: "rails/rails-controller-testing"
gem "responders", "~> 3.1"
group :test do
gem "nokogiri", "< 1.13"
gem "omniauth-facebook"
gem "omniauth-openid"
gem "rexml"

View File

@@ -112,7 +112,7 @@ GEM
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.6.1)
mini_portile2 (2.8.1)
minitest (5.17.0)
mocha (1.16.1)
multi_xml (0.6.0)
@@ -126,8 +126,8 @@ GEM
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.12.5)
mini_portile2 (~> 2.6.1)
nokogiri (1.14.2)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
@@ -223,7 +223,6 @@ PLATFORMS
DEPENDENCIES
devise!
mocha (~> 1.1)
nokogiri (< 1.13)
omniauth
omniauth-facebook
omniauth-oauth2

View File

@@ -14,7 +14,6 @@ gem "rails-controller-testing"
gem "responders", "~> 2.1"
group :test do
gem "nokogiri", "< 1.13"
gem "omniauth-facebook"
gem "omniauth-openid"
gem "timecop"

View File

@@ -12,7 +12,6 @@ gem "rails-controller-testing"
gem "responders", "~> 2.1"
group :test do
gem "nokogiri", "< 1.13"
gem "omniauth-facebook"
gem "omniauth-openid"
gem "timecop"

View File

@@ -12,7 +12,6 @@ gem "rails-controller-testing"
gem "responders", "~> 2.1"
group :test do
gem "nokogiri", "< 1.13"
gem "omniauth-facebook"
gem "omniauth-openid"
gem "timecop"

View File

@@ -12,7 +12,6 @@ gem "rails-controller-testing", github: "rails/rails-controller-testing"
gem "responders", "~> 3.1"
group :test do
gem "nokogiri", "< 1.13"
gem "omniauth-facebook"
gem "omniauth-openid"
gem "rexml"

View File

@@ -18,7 +18,6 @@ if RUBY_VERSION >= "3.1"
end
group :test do
gem "nokogiri", "< 1.13"
gem "omniauth-facebook"
gem "omniauth-openid"
gem "rexml"

View File

@@ -12,7 +12,6 @@ gem "rails-controller-testing", github: "rails/rails-controller-testing"
gem "responders", "~> 3.1"
group :test do
gem "nokogiri", "< 1.13"
gem "omniauth-facebook"
gem "omniauth-openid"
gem "rexml"

View File

@@ -0,0 +1,12 @@
# Monkey patch for Nokogiri changes - https://github.com/sparklemotion/nokogiri/issues/2469
module Webrat
module Matchers
class HaveSelector
def query
Nokogiri::CSS.parse(@expected.to_s).map do |ast|
ast.to_xpath("//", Nokogiri::CSS::XPathVisitor.new)
end.first
end
end
end
end