From 04a3d5ef07bbefff2ed9d51a416aa2acee003dd4 Mon Sep 17 00:00:00 2001 From: MaicolBen Date: Sun, 12 Jan 2025 21:57:51 -0300 Subject: [PATCH] Setup tests for 7.2 and 8.0 --- .github/workflows/test.yml | 26 ++++++++++++++ Appraisals | 3 +- devise_token_auth.gemspec | 2 +- gemfiles/rails_7_0.gemfile | 2 +- gemfiles/rails_7_1.gemfile | 47 +++++++++++++++++++++++++ gemfiles/rails_7_2.gemfile | 47 +++++++++++++++++++++++++ gemfiles/rails_8_0.gemfile | 48 ++++++++++++++++++++++++++ test/dummy/config/environments/test.rb | 8 +++-- test/test_helper.rb | 2 +- 9 files changed, 179 insertions(+), 6 deletions(-) create mode 100644 gemfiles/rails_7_1.gemfile create mode 100644 gemfiles/rails_7_2.gemfile create mode 100644 gemfiles/rails_8_0.gemfile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8041ae48e..6020a6167 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ jobs: - '3.0' - 3.1 - 3.2 + - 3.3 gemfile: - gemfiles/rails_4_2.gemfile - gemfiles/rails_5_0.gemfile @@ -21,6 +22,9 @@ jobs: - gemfiles/rails_5_2.gemfile - gemfiles/rails_6_0.gemfile - gemfiles/rails_7_0.gemfile + - gemfiles/rails_7_1.gemfile + - gemfiles/rails_7_2.gemfile + - gemfiles/rails_8_0.gemfile db: - sqlite - mysql @@ -51,6 +55,7 @@ jobs: - ruby: 3.2 gemfile: gemfiles/rails_7_0_mongoid_7.gemfile devise-token-auth-orm: mongoid + # TODO: add mongoid for rails 7.2 exclude: - ruby: 2.7 gemfile: gemfiles/rails_4_2.gemfile @@ -60,6 +65,10 @@ jobs: gemfile: gemfiles/rails_5_1.gemfile - ruby: 2.7 gemfile: gemfiles/rails_5_2.gemfile + - ruby: 2.7 + gemfile: gemfiles/rails_7_2.gemfile + - ruby: 2.7 + gemfile: gemfiles/rails_8_0.gemfile - ruby: '3.0' gemfile: gemfiles/rails_4_2.gemfile - ruby: '3.0' @@ -70,6 +79,12 @@ jobs: gemfile: gemfiles/rails_5_2.gemfile - ruby: '3.0' gemfile: gemfiles/rails_6_0.gemfile + - ruby: '3.0' + gemfile: gemfiles/rails_7_2.gemfile + - ruby: '3.0' + gemfile: gemfiles/rails_8_0.gemfile + - ruby: '3.0' + gemfile: gemfiles/rails_7_1.gemfile - ruby: 3.1 gemfile: gemfiles/rails_4_2.gemfile - ruby: 3.1 @@ -90,6 +105,17 @@ jobs: gemfile: gemfiles/rails_5_2.gemfile - ruby: 3.2 gemfile: gemfiles/rails_6_0.gemfile + - ruby: 3.3 + gemfile: gemfiles/rails_4_2.gemfile + - ruby: 3.3 + gemfile: gemfiles/rails_5_0.gemfile + - ruby: 3.3 + gemfile: gemfiles/rails_5_1.gemfile + - ruby: 3.3 + gemfile: gemfiles/rails_5_2.gemfile + - ruby: 3.3 + gemfile: gemfiles/rails_6_0.gemfile + services: mysql: diff --git a/Appraisals b/Appraisals index bd13707bf..53de7c175 100644 --- a/Appraisals +++ b/Appraisals @@ -35,7 +35,8 @@ end { name: '5-2', ruby: '2.6.2', rails: '5.2', mongoid: '7.0' }, { name: '6-0', ruby: '2.7.0', rails: '6.0', mongoid: '7.0' }, { name: '6-0', ruby: '3.1.2', rails: '6.0', mongoid: '7.0' }, - { name: '7-0', ruby: '3.1.2', rails: '7.0', mongoid: '7.0' } + { name: '7-0', ruby: '3.1.2', rails: '7.0', mongoid: '7.0' }, + { name: '7-1', ruby: '3.1.2', rails: '7.1', mongoid: '7.0' } ].each do |set| appraise "rails-#{set[:name]}-mongoid-#{set[:mongoid][0]}" do gem 'rails', "~> #{set[:rails]}" diff --git a/devise_token_auth.gemspec b/devise_token_auth.gemspec index 15482381e..94aea0648 100644 --- a/devise_token_auth.gemspec +++ b/devise_token_auth.gemspec @@ -30,6 +30,6 @@ Gem::Specification.new do |s| s.add_development_dependency 'sqlite3', '~> 1.4' s.add_development_dependency 'pg' s.add_development_dependency 'mysql2' - s.add_development_dependency 'mongoid', '>= 4', '< 8' + s.add_development_dependency 'mongoid', '>= 4', '< 10' s.add_development_dependency 'mongoid-locker', '~> 2.0' end diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile index b8e2d0875..df6b9d450 100644 --- a/gemfiles/rails_7_0.gemfile +++ b/gemfiles/rails_7_0.gemfile @@ -4,7 +4,7 @@ source "https://rubygems.org" gem "omniauth", "~> 2.0" gem "omniauth-rails_csrf_protection" -gem "rails", "~> 7.0" +gem "rails", "~> 7.0.8" gem "sqlite3", "~> 1.4.1" gem "mysql2" gem "pg" diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile new file mode 100644 index 000000000..3ab6904dc --- /dev/null +++ b/gemfiles/rails_7_1.gemfile @@ -0,0 +1,47 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "omniauth", "~> 2.0" +gem "omniauth-rails_csrf_protection" +gem 'rails', '~> 7.1.5' +gem "sqlite3", "~> 1.4.1" +gem "mysql2" +gem "pg" + +group :development, :test do + gem "attr_encrypted" + gem "figaro", "~> 1.2" + gem "omniauth-facebook" + gem "omniauth-github" + gem "omniauth-google-oauth2" + gem 'omniauth-apple' + gem "rack-cors" + gem "thor", "~> 1.2" + gem "database_cleaner" + gem "factory_bot_rails" + gem "faker", "~> 2.16" + gem "fuzz_ball" + gem "guard" + gem "guard-minitest" + gem "minitest" + gem "minitest-focus" + gem "minitest-rails", "~> 7" + gem "minitest-reporters" + gem "mocha", ">= 1.5" + gem "pry" + gem "pry-byebug" + gem "pry-remote" + gem "rubocop", require: false +end + +group :test do + gem "rails-controller-testing" + gem "simplecov", require: false +end + +group :development do + gem "github_changelog_generator" +end + +gemspec path: "../" diff --git a/gemfiles/rails_7_2.gemfile b/gemfiles/rails_7_2.gemfile new file mode 100644 index 000000000..629802a5c --- /dev/null +++ b/gemfiles/rails_7_2.gemfile @@ -0,0 +1,47 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "omniauth", "~> 2.0" +gem "omniauth-rails_csrf_protection" +gem 'rails', '~> 7.2.1.2' +gem "sqlite3", "~> 1.4.1" +gem "mysql2" +gem "pg" + +group :development, :test do + gem "attr_encrypted" + gem "figaro", "~> 1.2" + gem "omniauth-facebook" + gem "omniauth-github" + gem "omniauth-google-oauth2" + gem 'omniauth-apple' + gem "rack-cors" + gem "thor", "~> 1.2" + gem "database_cleaner" + gem "factory_bot_rails" + gem "faker", "~> 2.16" + gem "fuzz_ball" + gem "guard" + gem "guard-minitest" + gem "minitest" + gem "minitest-focus" + gem "minitest-rails", "~> 7" + gem "minitest-reporters" + gem "mocha", ">= 1.5" + gem "pry" + gem "pry-byebug" + gem "pry-remote" + gem "rubocop", require: false +end + +group :test do + gem "rails-controller-testing" + gem "simplecov", require: false +end + +group :development do + gem "github_changelog_generator" +end + +gemspec path: "../" diff --git a/gemfiles/rails_8_0.gemfile b/gemfiles/rails_8_0.gemfile new file mode 100644 index 000000000..16ff0c256 --- /dev/null +++ b/gemfiles/rails_8_0.gemfile @@ -0,0 +1,48 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "omniauth", "~> 2.0" +gem "omniauth-rails_csrf_protection" +gem "rails", "~> 8.0.0.rc1" +gem "sqlite3", "~> 1.4.1" +gem "mysql2" +gem "pg" +gem "mongoid", git: "https://github.com/comandeo-mongo/mongoid/5818-rails-8" + +group :development, :test do + gem "attr_encrypted" + gem "figaro", "~> 1.2" + gem "omniauth-facebook" + gem "omniauth-github" + gem "omniauth-google-oauth2" + gem 'omniauth-apple' + gem "rack-cors" + gem "thor", "~> 1.2" + gem "database_cleaner" + gem "factory_bot_rails" + gem "faker", "~> 2.16" + gem "fuzz_ball" + gem "guard" + gem "guard-minitest" + gem "minitest" + gem "minitest-focus" + gem "minitest-rails", "~> 7" + gem "minitest-reporters" + gem "mocha", ">= 1.5" + gem "pry" + gem "pry-byebug" + gem "pry-remote" + gem "rubocop", require: false +end + +group :test do + gem "rails-controller-testing" + gem "simplecov", require: false +end + +group :development do + gem "github_changelog_generator" +end + +gemspec path: "../" diff --git a/test/dummy/config/environments/test.rb b/test/dummy/config/environments/test.rb index 0a31ff05c..01faec3d7 100644 --- a/test/dummy/config/environments/test.rb +++ b/test/dummy/config/environments/test.rb @@ -23,7 +23,7 @@ (config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }) : (config.static_cache_control = 'public, max-age=3600') - if Rails::VERSION::MAJOR > 6 && ENV['DEVISE_TOKEN_AUTH_ORM'] != 'mongoid' + if Rails::VERSION::MAJOR < 7 && ENV['DEVISE_TOKEN_AUTH_ORM'] != 'mongoid' config.active_record.legacy_connection_handling = false end @@ -32,7 +32,11 @@ config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = false + if Rails::VERSION::MAJOR >= 7 + config.action_dispatch.show_exceptions = :none + else + config.action_dispatch.show_exceptions = false + end # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false diff --git a/test/test_helper.rb b/test/test_helper.rb index ef019e2fa..1acf4028c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -38,7 +38,7 @@ def follow_all_redirects! class ActiveSupport::TestCase include FactoryBot::Syntax::Methods - ActiveRecord::Migration.check_pending! if DEVISE_TOKEN_AUTH_ORM == :active_record + # ActiveRecord::Migration.check_pending! if DEVISE_TOKEN_AUTH_ORM == :active_record strategies = { active_record: :transaction, mongoid: :deletion }