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

@@ -9,8 +9,9 @@ jobs:
- Gemfile
- gemfiles/Gemfile-rails-main
- gemfiles/Gemfile-rails-7-0
- gemfiles/Gemfile-rails-6-1
- gemfiles/Gemfile-rails-6-0
- gemfiles/Gemfile-rails-7-1
- gemfiles/Gemfile-rails-7-2
- gemfiles/Gemfile-rails-8-0
ruby:
- '3.3'
- '3.2'
@@ -21,26 +22,32 @@ jobs:
- DEVISE_ORM=active_record
- DEVISE_ORM=mongoid
exclude:
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.7' # Rails > 7.1 supports Ruby >= 3.1
- gemfile: gemfiles/Gemfile-rails-main
ruby: '3.0' # Rails > 7.1 supports Ruby >= 3.1
- gemfile: gemfiles/Gemfile-rails-main
ruby: '3.1' # Rails >= 8.0 supports Ruby >= 3.2
- gemfile: Gemfile
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-main
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-7-0
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-6-1
env: DEVISE_ORM=mongoid
- gemfile: gemfiles/Gemfile-rails-6-0
ruby: '3.2'
- gemfile: gemfiles/Gemfile-rails-6-0
- gemfile: Gemfile
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-6-0
env: DEVISE_ORM=mongoid
- gemfile: Gemfile
ruby: '3.0'
- gemfile: Gemfile
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-main
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-8-0
ruby: '3.1'
- gemfile: gemfiles/Gemfile-rails-8-0
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-8-0
ruby: '2.7'
- gemfile: gemfiles/Gemfile-rails-7-2
ruby: '3.0'
- gemfile: gemfiles/Gemfile-rails-7-2
ruby: '2.7'
runs-on: ubuntu-latest
env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ matrix.gemfile }}

View File

@@ -4,9 +4,9 @@ source "https://rubygems.org"
gemspec
gem "rails", "~> 7.1.0"
gem "omniauth"
gem "omniauth-oauth2"
gem "rails", "~> 8.1.0.rc1"
gem "rdoc"
gem "rails-controller-testing", github: "rails/rails-controller-testing"
@@ -14,16 +14,16 @@ gem "rails-controller-testing", github: "rails/rails-controller-testing"
gem "responders", "~> 3.1"
group :test do
gem "mocha", "~> 2.1", require: false
gem "omniauth-facebook"
gem "omniauth-openid"
gem "rexml"
gem "timecop"
gem "webrat", "0.7.3", require: false
gem "mocha", "~> 2.1", require: false
gem "webrat"
end
platforms :ruby do
gem "sqlite3", "~> 1.4"
gem "sqlite3", "~> 2.1"
end
# platforms :jruby do

View File

@@ -20,87 +20,88 @@ PATH
GEM
remote: https://rubygems.org/
specs:
actioncable (7.1.0)
actionpack (= 7.1.0)
activesupport (= 7.1.0)
action_text-trix (2.1.15)
railties
actioncable (8.1.0.rc1)
actionpack (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.1.0)
actionpack (= 7.1.0)
activejob (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.1.0)
actionpack (= 7.1.0)
actionview (= 7.1.0)
activejob (= 7.1.0)
activesupport (= 7.1.0)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
actionmailbox (8.1.0.rc1)
actionpack (= 8.1.0.rc1)
activejob (= 8.1.0.rc1)
activerecord (= 8.1.0.rc1)
activestorage (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
mail (>= 2.8.0)
actionmailer (8.1.0.rc1)
actionpack (= 8.1.0.rc1)
actionview (= 8.1.0.rc1)
activejob (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.1.0)
actionview (= 7.1.0)
activesupport (= 7.1.0)
actionpack (8.1.0.rc1)
actionview (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
actiontext (7.1.0)
actionpack (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
useragent (~> 0.16)
actiontext (8.1.0.rc1)
action_text-trix (~> 2.1.15)
actionpack (= 8.1.0.rc1)
activerecord (= 8.1.0.rc1)
activestorage (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.1.0)
activesupport (= 7.1.0)
actionview (8.1.0.rc1)
activesupport (= 8.1.0.rc1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.1.0)
activesupport (= 7.1.0)
activejob (8.1.0.rc1)
activesupport (= 8.1.0.rc1)
globalid (>= 0.3.6)
activemodel (7.1.0)
activesupport (= 7.1.0)
activerecord (7.1.0)
activemodel (= 7.1.0)
activesupport (= 7.1.0)
activemodel (8.1.0.rc1)
activesupport (= 8.1.0.rc1)
activerecord (8.1.0.rc1)
activemodel (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
timeout (>= 0.4.0)
activestorage (7.1.0)
actionpack (= 7.1.0)
activejob (= 7.1.0)
activerecord (= 7.1.0)
activesupport (= 7.1.0)
activestorage (8.1.0.rc1)
actionpack (= 8.1.0.rc1)
activejob (= 8.1.0.rc1)
activerecord (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
marcel (~> 1.0)
activesupport (7.1.0)
activesupport (8.1.0.rc1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
json
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
base64 (0.1.1)
bcrypt (3.1.19)
bigdecimal (3.1.4)
builder (3.2.4)
concurrent-ruby (1.2.2)
concurrent-ruby (1.3.5)
connection_pool (2.4.1)
crass (1.0.6)
date (3.3.3)
date (3.4.1)
drb (2.1.1)
ruby2_keywords
erubi (1.12.0)
@@ -109,16 +110,19 @@ GEM
faraday-net_http (>= 2.0, < 3.1)
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
globalid (1.2.1)
globalid (1.3.0)
activesupport (>= 6.1)
hashie (5.0.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
irb (1.8.1)
rdoc
reline (>= 0.3.8)
irb (1.15.1)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
json (2.15.1)
jwt (2.7.1)
logger (1.6.6)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
@@ -127,24 +131,23 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.2)
marcel (1.1.0)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.20.0)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
multi_xml (0.6.0)
mutex_m (0.1.2)
net-imap (0.4.1)
net-imap (0.5.12)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
net-protocol (0.2.2)
timeout
net-smtp (0.4.0)
net-smtp (0.5.1)
net-protocol
nio4r (2.5.9)
nio4r (2.7.4)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
@@ -168,6 +171,9 @@ GEM
omniauth (>= 1.0, < 3.0)
rack-openid (~> 1.4.0)
orm_adapter (0.5.0)
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
psych (5.1.0)
stringio
racc (1.7.1)
@@ -184,20 +190,20 @@ GEM
rackup (1.0.0)
rack (< 3)
webrick
rails (7.1.0)
actioncable (= 7.1.0)
actionmailbox (= 7.1.0)
actionmailer (= 7.1.0)
actionpack (= 7.1.0)
actiontext (= 7.1.0)
actionview (= 7.1.0)
activejob (= 7.1.0)
activemodel (= 7.1.0)
activerecord (= 7.1.0)
activestorage (= 7.1.0)
activesupport (= 7.1.0)
rails (8.1.0.rc1)
actioncable (= 8.1.0.rc1)
actionmailbox (= 8.1.0.rc1)
actionmailer (= 8.1.0.rc1)
actionpack (= 8.1.0.rc1)
actiontext (= 8.1.0.rc1)
actionview (= 8.1.0.rc1)
activejob (= 8.1.0.rc1)
activemodel (= 8.1.0.rc1)
activerecord (= 8.1.0.rc1)
activestorage (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
bundler (>= 1.15.0)
railties (= 7.1.0)
railties (= 8.1.0.rc1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
@@ -205,18 +211,19 @@ GEM
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.1.0)
actionpack (= 7.1.0)
activesupport (= 7.1.0)
irb
railties (8.1.0.rc1)
actionpack (= 8.1.0.rc1)
activesupport (= 8.1.0.rc1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
tsort (>= 0.2)
zeitwerk (~> 2.6)
rake (13.0.6)
rdoc (6.5.0)
psych (>= 4.0.0)
reline (0.3.9)
reline (0.6.0)
io-console (~> 0.5)
responders (3.1.0)
actionpack (>= 5.2)
@@ -224,17 +231,21 @@ GEM
rexml (3.2.6)
ruby-openid (2.9.2)
ruby2_keywords (0.0.5)
securerandom (0.4.1)
snaky_hash (2.0.1)
hashie
version_gem (~> 1.1, >= 1.1.1)
sqlite3 (1.6.6)
sqlite3 (2.6.0)
mini_portile2 (~> 2.8.0)
stringio (3.0.8)
thor (1.2.2)
timecop (0.9.8)
timeout (0.4.0)
timeout (0.4.3)
tsort (0.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uri (1.0.3)
useragent (0.16.11)
version_gem (1.1.3)
warden (1.2.9)
rack (>= 2.0.9)
@@ -243,7 +254,8 @@ GEM
rack (>= 1.0)
rack-test (>= 0.5.3)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-driver (0.8.0)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.12)
@@ -258,14 +270,14 @@ DEPENDENCIES
omniauth-facebook
omniauth-oauth2
omniauth-openid
rails (~> 7.1.0)
rails (~> 8.1.0.rc1)
rails-controller-testing!
rdoc
responders (~> 3.1)
rexml
sqlite3 (~> 1.4)
sqlite3 (~> 2.1)
timecop
webrat (= 0.7.3)
webrat
BUNDLED WITH
2.4.5

View File

@@ -1,5 +1,3 @@
# frozen_string_literal: true
source "https://rubygems.org"
gemspec path: ".."
@@ -25,14 +23,3 @@ end
platforms :ruby do
gem "sqlite3", "~> 1.4"
end
# platforms :jruby do
# gem "activerecord-jdbc-adapter"
# gem "activerecord-jdbcsqlite3-adapter"
# gem "jruby-openssl"
# end
# TODO:
# group :mongoid do
# gem "mongoid", "~> 4.0.0"
# end

View File

@@ -2,7 +2,7 @@ source "https://rubygems.org"
gemspec path: ".."
gem "rails", '~> 6.0.0', github: 'rails/rails', branch: '6-0-stable'
gem "rails", "~> 7.1.0"
gem "omniauth"
gem "omniauth-oauth2"
gem "rdoc"
@@ -16,7 +16,7 @@ group :test do
gem "omniauth-openid"
gem "rexml"
gem "timecop"
gem "webrat", "0.7.3", require: false
gem "webrat"
gem "mocha", "~> 2.1", require: false
end

View File

@@ -2,7 +2,8 @@ source "https://rubygems.org"
gemspec path: ".."
gem "rails", '~> 6.1.0'
gem "rails", "~> 7.1.0"
gem "omniauth"
gem "omniauth-oauth2"
gem "rdoc"
@@ -11,18 +12,12 @@ gem "rails-controller-testing", github: "rails/rails-controller-testing"
gem "responders", "~> 3.1"
if RUBY_VERSION >= "3.1"
gem "net-smtp", require: false
gem "net-imap", require: false
gem "net-pop", require: false
end
group :test do
gem "omniauth-facebook"
gem "omniauth-openid"
gem "rexml"
gem "timecop"
gem "webrat", "0.7.3", require: false
gem "webrat", require: false
gem "mocha", "~> 2.1", require: false
end

View File

@@ -0,0 +1,25 @@
source "https://rubygems.org"
gemspec path: ".."
gem "rails", "~> 8.0.0"
gem "omniauth"
gem "omniauth-oauth2"
gem "rdoc"
gem "rails-controller-testing", github: "rails/rails-controller-testing"
gem "responders", "~> 3.1"
group :test do
gem "omniauth-facebook"
gem "omniauth-openid"
gem "rexml"
gem "timecop"
gem 'webrat'
gem "mocha", "~> 2.1", require: false
end
platforms :ruby do
gem "sqlite3", "~> 2.1"
end

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