Skip to content

Commit

Permalink
Merge pull request #106 from mbobin/master
Browse files Browse the repository at this point in the history
Run CI on Ruby 3.1 and 3.2
  • Loading branch information
rafaelfranca authored Jun 6, 2023
2 parents 8b34ac5 + a1c1aa6 commit 33a5d17
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 6 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,33 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.6', '2.7', '3.0', 'jruby']
ruby-version: ['2.6', '2.7', '3.0', '3.1', '3.2', 'jruby']
gemfiles:
- gemfiles/active_record_5.1.gemfile
- gemfiles/active_record_5.2.gemfile
- gemfiles/active_record_6.0.gemfile
- gemfiles/active_record_6.1.gemfile
- gemfiles/active_record_7.0.gemfile
- gemfiles/active_record_edge.gemfile
exclude:
- ruby-version: '2.6'
gemfiles: gemfiles/active_record_7.0.gemfile
- ruby-version: '2.6'
gemfiles: gemfiles/active_record_edge.gemfile
- ruby-version: '3.0'
gemfiles: gemfiles/active_record_5.1.gemfile
- ruby-version: '3.0'
gemfiles: gemfiles/active_record_5.2.gemfile
- ruby-version: '2.6'
gemfiles: gemfiles/active_record_edge.gemfile
- ruby-version: '3.1'
gemfiles: gemfiles/active_record_5.1.gemfile
- ruby-version: '3.1'
gemfiles: gemfiles/active_record_5.2.gemfile
- ruby-version: '3.2'
gemfiles: gemfiles/active_record_5.1.gemfile
- ruby-version: '3.2'
gemfiles: gemfiles/active_record_5.2.gemfile
- ruby-version: 'jruby'
gemfiles: gemfiles/active_record_7.0.gemfile
- ruby-version: 'jruby'
gemfiles: gemfiles/active_record_edge.gemfile
env:
Expand Down
6 changes: 6 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ appraise 'active_record_6.1' do
gem "activerecord", '~> 6.1.3'
end

appraise 'active_record_7.0' do
gem "sqlite3", platforms: [:mri, :rbx]
gem "activerecord-jdbcsqlite3-adapter", platform: [:jruby, :truffleruby]
gem "activerecord", '~> 7.0.4'
end

appraise "active_record_edge" do
gem "sqlite3", platforms: [:mri, :rbx]
gem "activerecord-jdbcsqlite3-adapter", platform: [:jruby, :truffleruby]
Expand Down
13 changes: 13 additions & 0 deletions gemfiles/active_record_7.0.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "sqlite3", platforms: [:mri, :rbx]
gem "activerecord-jdbcsqlite3-adapter", platform: [:jruby, :truffleruby]
gem "activerecord", "~> 7.0.4"

platforms :mri do
gem "pry-byebug"
end

gemspec path: "../"
2 changes: 1 addition & 1 deletion test/machine_with_event_attributes_on_autosave_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def teardown
remove_const('Vehicle')
remove_const('Owner')
end
ActiveSupport::Dependencies.clear if defined?(ActiveSupport::Dependencies)
clear_active_support_dependencies
super
end
end
3 changes: 2 additions & 1 deletion test/machine_with_scopes_and_joins_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def teardown
remove_const('Vehicle')
remove_const('Company')
end
ActiveSupport::Dependencies.clear

clear_active_support_dependencies
end
end
3 changes: 2 additions & 1 deletion test/machine_with_static_initial_state_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ def teardown
remove_const('Owner') if defined?(MachineWithStaticInitialStateTest::Owner)
remove_const('Driver') if defined?(MachineWithStaticInitialStateTest::Driver)
end
ActiveSupport::Dependencies.clear

clear_active_support_dependencies
super
end
end
Expand Down
16 changes: 16 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,20 @@ class << self;
model.reset_column_information if create_table
model
end

def clear_active_support_dependencies
return unless defined?(ActiveSupport::Dependencies)

if ActiveSupport::Dependencies.respond_to?(:autoloader=)
ActiveSupport::Dependencies.autoloader ||= stubbed_autoloader
end

ActiveSupport::Dependencies.clear
end

def stubbed_autoloader
Object.new.tap do |obj|
obj.define_singleton_method(:reload) {}
end
end
end

0 comments on commit 33a5d17

Please sign in to comment.