Skip to content

Commit

Permalink
Update appraisals and handle new ruby versions
Browse files Browse the repository at this point in the history
  • Loading branch information
chaadow committed Jun 18, 2024
1 parent 975b476 commit 7a7400b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1', '3.2']
activerecord: ['6.0', '6.1', '7.0', 'main']
ruby-version: ['3.1', '3.2', '3.3']
activerecord: ['7.0', '7.1', 'main']
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile
steps:
Expand Down
10 changes: 3 additions & 7 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
appraise "rails-6.0" do
gem 'rails', '~> 6.0'
end

appraise "rails-6.1" do
gem 'rails', '~> 6.1'
appraise "rails-7.0" do
gem 'rails', '~> 7.0'
end

appraise "rails-7.0" do
appraise "rails-7.1" do
gem 'rails', '~> 7.0'
end

Expand Down
6 changes: 2 additions & 4 deletions active_record-acts_as.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@ Gem::Specification.new do |spec|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.5"
spec.required_ruby_version = ">= 3.1"

spec.add_development_dependency "sqlite3"
spec.add_development_dependency "bundler"
spec.add_development_dependency "rspec", "~> 3"
spec.add_development_dependency "psych", "3.3.2"
spec.add_development_dependency "rake"
spec.add_development_dependency "appraisal", "~> 2.1"
spec.add_development_dependency "appraisal"
spec.add_development_dependency "guard-rspec", "~> 4.7"

spec.add_dependency "activesupport", ">= 6.0"
spec.add_dependency "activerecord", ">= 6.0"
spec.add_dependency "ruby2_keywords"

end
8 changes: 0 additions & 8 deletions gemfiles/rails_6.1.gemfile

This file was deleted.

1 change: 1 addition & 0 deletions gemfiles/rails_7.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ source "https://rubygems.org"

gem "coveralls", require: false
gem "rails", "~> 7.0"
gem "sqlite3", "~> 1.4"

gemspec path: "../"
3 changes: 2 additions & 1 deletion gemfiles/rails_6.0.gemfile → gemfiles/rails_7.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
source "https://rubygems.org"

gem "coveralls", require: false
gem "rails", "~> 6.0"
gem "rails", "~> 7.0"
gem "sqlite3", "~> 1.4"

gemspec path: "../"
4 changes: 2 additions & 2 deletions lib/active_record/acts_as/class_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def respond_to_missing?(method, include_private = false)
acting_as_model.methods_callable_by_submodel.include?(method) || super
end

ruby2_keywords def method_missing(method, *args, &block)
def method_missing(method, ...)
if acting_as_model.methods_callable_by_submodel.include?(method)
result = acting_as_model.public_send(method, *args, &block)
result = acting_as_model.public_send(method, ...)
if result.is_a?(ActiveRecord::Relation)
all.joins(acting_as_name.to_sym).merge(result)
else
Expand Down
4 changes: 2 additions & 2 deletions lib/active_record/acts_as/instance_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ def dup
duplicate
end

ruby2_keywords def method_missing(method, *args, &block)
def method_missing(method, ...)
if !self_respond_to?(method) && acting_as.respond_to?(method)
acting_as.send(method, *args, &block)
acting_as.send(method, ...)
else
super
end
Expand Down
2 changes: 1 addition & 1 deletion spec/actable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

it "raises NoMethodError for undefined methods on specific" do
pen.save
expect{ pen.product.raise_error }.to raise_error(NoMethodError, /undefined method `non_existant_method' for #<Pen/)
expect{ pen.product.raise_error }.to raise_error(NoMethodError, /undefined method `non_existant_method' for /)
end

it "deletes specific subclass on destroy" do
Expand Down

0 comments on commit 7a7400b

Please sign in to comment.