Skip to content

Commit

Permalink
Support Ruby 3.2 and 3.3, Rails 7.1 and 7.2 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshand authored Nov 21, 2024
1 parent 6f36047 commit 6c6c33c
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,23 @@ jobs:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
gemfile:
- gemfiles/Gemfile.rails61
- gemfiles/Gemfile.rails70
- gemfiles/Gemfile.rails71
- gemfiles/Gemfile.rails72
exclude:
# rails 7.2 requires ruby >= 3.1
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
- ruby-version: '3.0'
gemfile: 'gemfiles/Gemfile.rails72'
# rails 8.0 requires ruby >= 3.2
# https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html
- ruby-version: '3.0'
gemfile: 'gemfiles/Gemfile.rails80'
- ruby-version: '3.1'
gemfile: 'gemfiles/Gemfile.rails80'

name: Ruby ${{ matrix.ruby-version }} / Bundle ${{ matrix.gemfile }}

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## [Unreleased]
### Fixed
* Support Ruby 3.2 and 3.3, Rails 7.1 and 7.2

### Added
* Support Ruby 3.2. Drop support for Ruby 2.7, Rails 6.0

Expand Down
4 changes: 4 additions & 0 deletions gemfiles/Gemfile.rails61
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ source 'https://rubygems.org'
gemspec path: '..'

gem 'rails', '~> 6.1.0'

# Rails 6.1 does not support sqlite3 2.x; it specifies gem "sqlite3", "~> 1.4"
# in lib/active_record/connection_adapters/sqlite3_adapter.rb
gem 'sqlite3', '~> 1.7'
4 changes: 4 additions & 0 deletions gemfiles/Gemfile.rails70
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ source 'https://rubygems.org'
gemspec path: '..'

gem 'rails', '~> 7.0.0'

# Rails 7.0 does not support sqlite3 2.x; it specifies gem "sqlite3", "~> 1.4"
# in lib/active_record/connection_adapters/sqlite3_adapter.rb
gem 'sqlite3', '~> 1.7'
8 changes: 8 additions & 0 deletions gemfiles/Gemfile.rails71
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'rails', '~> 7.1.0'

# sqlite3 2.x is not supported on ruby 3.0
gem 'sqlite3', '~> 1.7'
5 changes: 5 additions & 0 deletions gemfiles/Gemfile.rails72
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source 'https://rubygems.org'

gemspec path: '..'

gem 'rails', '~> 7.2.0'
6 changes: 5 additions & 1 deletion ndr_error.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 3.0'

s.add_dependency 'rails', '>= 6.1', '< 7.1'
s.add_dependency 'rails', '>= 6.1', '< 7.3'

# Support rails 6.1 with Ruby 3.1
s.add_dependency 'net-imap'
Expand All @@ -32,6 +32,10 @@ Gem::Specification.new do |s|

s.add_development_dependency 'pry'
s.add_development_dependency 'puma'

# Rails 6.1 and 7.0 do not support sqlite3 2.x; they specify gem "sqlite3", "~> 1.4"
# in lib/active_record/connection_adapters/sqlite3_adapter.rb
# cf. gemfiles/Gemfile.rails70
s.add_development_dependency 'sqlite3'

s.add_development_dependency 'mocha'
Expand Down
8 changes: 6 additions & 2 deletions test/dummy/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
module Dummy
# Dummy application to host and test the engine
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.1
# Initialize configuration defaults for current Rails version.
config.load_defaults Rails.version.match(/[0-9]*[.][0-9]*/).to_s # e.g. 7.2

# Rails 6.1 default
# TODO: Some of our tests fail when this Rails 6.1 default is removed
config.active_support.executor_around_test_case = false

# Configuration for the application, engines, and railties goes here.
#
Expand Down
2 changes: 1 addition & 1 deletion test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
config.cache_store = :null_store

# Let middleware intercept errors:
config.action_dispatch.show_exceptions = true
config.action_dispatch.show_exceptions = :all

# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
Expand Down
2 changes: 1 addition & 1 deletion test/unit/ndr_error/log_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def setup

test 'should auto-calculate clock drift on create when configured' do
test_checker = lambda do
stamp = ActiveRecord::Base.connection.execute('select CURRENT_TIMESTAMP')[0][0]
stamp = ActiveRecord::Base.connection.execute('select CURRENT_TIMESTAMP')[0]['CURRENT_TIMESTAMP']
Time.zone.parse(stamp) + Time.zone.utc_offset
end

Expand Down

0 comments on commit 6c6c33c

Please sign in to comment.