Skip to content

Commit

Permalink
Add support for Rails 7.2 and 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-thatch committed Nov 27, 2024
1 parent 4de3c72 commit 1aeee0f
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 14 deletions.
11 changes: 2 additions & 9 deletions .github/workflows/test_suite.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
name: Test Suite

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# 00:00 on the 1st of every month
- cron: '0 0 1 * *'
on: [push]

jobs:
run-tests:
Expand All @@ -16,7 +9,7 @@ jobs:
fail-fast: false
matrix:
orm: [active_record, mongoid]
rails: ["7.0", "7.1"]
rails: ["7.0", "7.1", "7.2", "8.0"]
ruby: ["3.1", "3.2", "3.3", head]
steps:
- uses: actions/checkout@v4
Expand Down
13 changes: 9 additions & 4 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ appraise 'rails-7.1' do
gem 'minitest-rails', '~> 7.1.0'
end

# appraise 'rails-7.2' do
# gem 'railties', '~> 7.2.0'
# gem 'minitest-rails', '~> 7.1.0' # TODO: Update to 7.2.0 when it is released
# end
appraise 'rails-7.2' do
gem 'railties', '~> 7.2.0'
gem 'minitest-rails', '~> 7.1.0' # TODO: Update to 7.2.0 when it is released
end

appraise 'rails-8.0' do
gem 'railties', '~> 7.2.0'
gem 'minitest-rails', github: "bquorning/minitest-rails", branch: "rails-8-0" # TODO: Update to 8.0.0 when it is released
end
2 changes: 1 addition & 1 deletion gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ group :active_record do
end

group :mongoid do
gem "mongoid", "~> 8.0"
gem "mongoid", "~> 9.0"

group :test do
gem "database_cleaner-mongoid", "~> 2.0"
Expand Down
27 changes: 27 additions & 0 deletions gemfiles/rails_7.2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "minitest-rails", "~> 7.1.0"
gem "railties", "~> 7.2.0"
gem "bigdecimal", require: false
gem "drb", require: false

group :active_record do
gem "pg"
gem "sqlite3", "~> 1.4"
end

group :mongoid do
gem "mongoid", "~> 9.0"

group :test do
gem "database_cleaner-mongoid", "~> 2.0"
end
end

group :test do
gem "rails-controller-testing"
end

gemspec path: "../"
27 changes: 27 additions & 0 deletions gemfiles/rails_8.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "minitest-rails", github: "bquorning/minitest-rails", branch: "rails-8-0"
gem "railties", "~> 8.0.0"
gem "bigdecimal", require: false
gem "drb", require: false

group :active_record do
gem "pg"
gem "sqlite3", "~> 1.4"
end

group :mongoid do
gem "mongoid", "~> 9.0"

group :test do
gem "database_cleaner-mongoid", "~> 2.0"
end
end

group :test do
gem "rails-controller-testing"
end

gemspec path: "../"
2 changes: 2 additions & 0 deletions test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

module RailsApp
class Application < Rails::Application
config.load_defaults 7.0

config.encoding = 'utf-8'

config.filter_parameters += [:password]
Expand Down
21 changes: 21 additions & 0 deletions test/support/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,26 @@ def generate_unique_username
def generate_unique_email
"#{generate_unique_username}@example.com"
end

def with_deprecation_behavior(behavior)
rails_71_and_up = Gem::Version.new(Rails.version) >= Gem::Version.new('7.1')
if rails_71_and_up
old_behavior = Rails.application.deprecators[DEVISE_ORM].behavior
Rails.application.deprecators.behavior = behavior
else
old_behavior = ActiveSupport::Deprecation.behavior
ActiveSupport::Deprecation.behavior = behavior
end

begin
yield
ensure
if rails_71_and_up
Rails.application.deprecators.behavior = old_behavior
else
ActiveSupport::Deprecation.behavior = old_behavior
end
end
end
end
end

0 comments on commit 1aeee0f

Please sign in to comment.