Make test suite work (#5770)

* Drop support for Rails < 7 and Ruby < 2.7
* Add tests to support to Rails 8+
* Fix test suite across all supported versions
This commit is contained in:
Greg Molnar
2025-10-21 19:52:04 +00:00
committed by GitHub
parent 9c5e4d3c4e
commit dbc8e77ea0
9 changed files with 161 additions and 130 deletions

View File

@@ -2,6 +2,7 @@
require File.expand_path('../boot', __FILE__)
require "logger"
require "action_controller/railtie"
require "action_mailer/railtie"
require "rails/test_unit/railtie"

View File

@@ -4,9 +4,13 @@ module Webrat
class HaveSelector
def query
Nokogiri::CSS.parse(@expected.to_s).map do |ast|
ast.to_xpath("//", Nokogiri::CSS::XPathVisitor.new)
if ::Gem::Version.new(Nokogiri::VERSION) < ::Gem::Version.new('1.17.2')
ast.to_xpath('//', Nokogiri::CSS::XPathVisitor.new)
else
ast.to_xpath(Nokogiri::CSS::XPathVisitor.new)
end
end.first
end
end
end
end
end