From 541285733737f8a79abcac2372f9e2074cc714b8 Mon Sep 17 00:00:00 2001 From: Jan-Willem van der Meer Date: Sat, 23 Nov 2024 09:24:11 +0100 Subject: [PATCH] Test against rails 8.0 (#3702) * test against rails 8.0 * allow rails 8 * Require more recent version of sqlite for rails 8 * Upgrade required sqlite version to 2.2, fix json spec * Make sure the dummy uses sqlite3 2.2 as well * Only upgrade sqlite3 for rails 8 * Don't use the newer version of sqlite in the dummy app --- .github/workflows/test.yml | 5 ++ Appraisals | 11 ++++ Gemfile | 2 +- gemfiles/composite_primary_keys.gemfile | 2 +- gemfiles/rails_6.0.gemfile | 2 +- gemfiles/rails_6.1.gemfile | 2 +- gemfiles/rails_7.0.gemfile | 2 +- gemfiles/rails_7.1.gemfile | 2 +- gemfiles/rails_7.2.gemfile | 2 +- gemfiles/rails_8.0.gemfile | 55 +++++++++++++++++++ rails_admin.gemspec | 2 +- spec/dummy_app/Gemfile | 2 +- spec/dummy_app/Gemfile.rails6 | 2 +- .../config/fields/types/json_spec.rb | 4 +- 14 files changed, 83 insertions(+), 12 deletions(-) create mode 100644 gemfiles/rails_8.0.gemfile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 882f24ee83..7cb8012e40 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,6 +58,11 @@ jobs: orm: active_record adapter: sqlite3 asset: sprockets + - ruby: "3.3" + gemfile: gemfiles/rails_8.0.gemfile + orm: active_record + adapter: sqlite3 + asset: sprockets - ruby: "3.2" gemfile: gemfiles/composite_primary_keys.gemfile orm: active_record diff --git a/Appraisals b/Appraisals index ca42f19384..f6afa83e49 100644 --- a/Appraisals +++ b/Appraisals @@ -94,6 +94,17 @@ appraise 'rails-7.2' do gem 'importmap-rails', require: false end +appraise 'rails-8.0' do + gem 'rails', '~> 8.0.0' + gem 'importmap-rails', require: false + + group :active_record do + platforms :ruby, :mswin, :mingw, :x64_mingw do + gem 'sqlite3', '~> 2.2' + end + end +end + appraise 'composite_primary_keys' do gem 'rails', '~> 7.0.0' diff --git a/Gemfile b/Gemfile index 904083a026..0965e94b45 100644 --- a/Gemfile +++ b/Gemfile @@ -49,7 +49,7 @@ group :active_record do platforms :ruby, :mswin, :mingw, :x64_mingw do gem 'mysql2', '>= 0.3.14' gem 'pg', '>= 1.0.0' - gem 'sqlite3', '~> 1.3' + gem 'sqlite3', '>= 1.3.0' end end diff --git a/gemfiles/composite_primary_keys.gemfile b/gemfiles/composite_primary_keys.gemfile index 1ebba5c55d..9bd5dd8203 100644 --- a/gemfiles/composite_primary_keys.gemfile +++ b/gemfiles/composite_primary_keys.gemfile @@ -48,7 +48,7 @@ group :active_record do platforms :ruby, :mswin, :mingw, :x64_mingw do gem "mysql2", ">= 0.3.14" gem "pg", ">= 1.0.0" - gem "sqlite3", "~> 1.3" + gem "sqlite3", ">= 1.3.0" end end diff --git a/gemfiles/rails_6.0.gemfile b/gemfiles/rails_6.0.gemfile index b57ca868df..75954b32ec 100644 --- a/gemfiles/rails_6.0.gemfile +++ b/gemfiles/rails_6.0.gemfile @@ -48,7 +48,7 @@ group :active_record do platforms :ruby, :mswin, :mingw, :x64_mingw do gem "mysql2", ">= 0.3.14" gem "pg", ">= 1.0.0" - gem "sqlite3", "~> 1.3" + gem "sqlite3", ">= 1.3.0" end platforms :jruby do diff --git a/gemfiles/rails_6.1.gemfile b/gemfiles/rails_6.1.gemfile index 8c4b1c44c3..cdf08f0c85 100644 --- a/gemfiles/rails_6.1.gemfile +++ b/gemfiles/rails_6.1.gemfile @@ -47,7 +47,7 @@ group :active_record do platforms :ruby, :mswin, :mingw, :x64_mingw do gem "mysql2", ">= 0.3.14" gem "pg", ">= 1.0.0" - gem "sqlite3", "~> 1.3" + gem "sqlite3", ">= 1.3.0" end platforms :jruby do diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index 36f7ff8cf6..2275d525a1 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -48,7 +48,7 @@ group :active_record do platforms :ruby, :mswin, :mingw, :x64_mingw do gem "mysql2", ">= 0.3.14" gem "pg", ">= 1.0.0" - gem "sqlite3", "~> 1.3" + gem "sqlite3", ">= 1.3.0" end platforms :jruby do diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile index 98c7769fbc..b9c62f5b83 100644 --- a/gemfiles/rails_7.1.gemfile +++ b/gemfiles/rails_7.1.gemfile @@ -48,7 +48,7 @@ group :active_record do platforms :ruby, :mswin, :mingw, :x64_mingw do gem "mysql2", ">= 0.3.14" gem "pg", ">= 1.0.0" - gem "sqlite3", "~> 1.3" + gem "sqlite3", ">= 1.3.0" end end diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile index f0edccff88..94dc6a1fab 100644 --- a/gemfiles/rails_7.2.gemfile +++ b/gemfiles/rails_7.2.gemfile @@ -48,7 +48,7 @@ group :active_record do platforms :ruby, :mswin, :mingw, :x64_mingw do gem "mysql2", ">= 0.3.14" gem "pg", ">= 1.0.0" - gem "sqlite3", "~> 1.3" + gem "sqlite3", ">= 1.3.0" end end diff --git a/gemfiles/rails_8.0.gemfile b/gemfiles/rails_8.0.gemfile new file mode 100644 index 0000000000..6e98f9dc61 --- /dev/null +++ b/gemfiles/rails_8.0.gemfile @@ -0,0 +1,55 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal", ">= 2.0" +gem "devise", "~> 4.7" +gem "net-smtp", require: false +gem "rails", "~> 8.0.0" +gem "sassc-rails", "~> 2.1" +gem "turbo-rails" +gem "vite_rails", require: false +gem "webpacker", require: false +gem "webrick" +gem "importmap-rails", require: false + +group :development, :test do + gem "pry", ">= 0.9" +end + +group :test do + gem "cancancan", "~> 3.0" + gem "carrierwave", [">= 2.0.0.rc", "< 3"] + gem "cuprite", "!= 0.15.1" + gem "database_cleaner-active_record", ">= 2.0", require: false + gem "dragonfly", "~> 1.0" + gem "factory_bot", ">= 4.2", "!= 6.4.5" + gem "generator_spec", ">= 0.8" + gem "kt-paperclip" + gem "launchy", ">= 2.2" + gem "mini_magick", ">= 3.4" + gem "pundit" + gem "rack-cache", require: "rack/cache" + gem "rspec-expectations", "!= 3.8.3" + gem "rspec-rails", ">= 4.0.0.beta2" + gem "rspec-retry" + gem "rubocop", ["~> 1.20", "!= 1.22.2"], require: false + gem "rubocop-performance", require: false + gem "shrine", "~> 3.0" + gem "simplecov", ">= 0.9", require: false + gem "simplecov-lcov", require: false + gem "timecop", ">= 0.5" + gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] +end + +group :active_record do + gem "paper_trail", ">= 12.0" + + platforms :ruby, :mswin, :mingw, :x64_mingw do + gem "mysql2", ">= 0.3.14" + gem "pg", ">= 1.0.0" + gem "sqlite3", "~> 2.2" + end +end + +gemspec path: "../" diff --git a/rails_admin.gemspec b/rails_admin.gemspec index 1905c682fd..27bc72b3dc 100644 --- a/rails_admin.gemspec +++ b/rails_admin.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |spec| spec.add_dependency 'csv' spec.add_dependency 'kaminari', '>= 0.14', '< 2.0' spec.add_dependency 'nested_form', '~> 0.3' - spec.add_dependency 'rails', ['>= 6.0', '< 8'] + spec.add_dependency 'rails', ['>= 6.0', '< 9'] spec.add_dependency 'turbo-rails', ['>= 1.0', '< 3'] spec.add_development_dependency 'bundler', '>= 1.0' spec.authors = ['Erik Michaels-Ober', 'Bogdan Gaza', 'Petteri Kaapa', 'Benoit Benezech', 'Mitsuhiro Shibuya'] diff --git a/spec/dummy_app/Gemfile b/spec/dummy_app/Gemfile index 5a16903ea3..5dba7ea5f5 100644 --- a/spec/dummy_app/Gemfile +++ b/spec/dummy_app/Gemfile @@ -14,7 +14,7 @@ group :active_record do platforms :ruby, :mswin, :mingw do gem 'mysql2', '>= 0.3.14' gem 'pg', '>= 0.14' - gem 'sqlite3', '~> 1.3' + gem 'sqlite3', '>= 1.3.0' end gem 'paper_trail', '>= 12.0' diff --git a/spec/dummy_app/Gemfile.rails6 b/spec/dummy_app/Gemfile.rails6 index 260b684c14..5b5c845348 100644 --- a/spec/dummy_app/Gemfile.rails6 +++ b/spec/dummy_app/Gemfile.rails6 @@ -13,7 +13,7 @@ group :active_record do platforms :ruby, :mswin, :mingw do gem 'mysql2', '>= 0.3.14' gem 'pg', '>= 0.14' - gem 'sqlite3', '>= 1.3.0' + gem 'sqlite3', '~> 2.2' end gem 'paper_trail', '>= 12.0' diff --git a/spec/rails_admin/config/fields/types/json_spec.rb b/spec/rails_admin/config/fields/types/json_spec.rb index a1e0395827..a749d93025 100644 --- a/spec/rails_admin/config/fields/types/json_spec.rb +++ b/spec/rails_admin/config/fields/types/json_spec.rb @@ -24,7 +24,7 @@ it 'returns correct value for empty json' do allow(object).to receive(:json_field) { {} } actual = field.with(bindings).formatted_value - expect(actual).to match(/{\n+}/) + expect(actual).to match(/{\n*}/) end it 'retuns correct value' do @@ -72,7 +72,7 @@ it 'returns correct value for empty json' do allow(object).to receive(:json_field) { {} } actual = field.with(bindings).export_value - expect(actual).to match(/{\n+}/) + expect(actual).to match(/{\n*}/) end it 'returns correct value' do