Skip to content

Update appraisals and handle new ruby versions #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
28 changes: 12 additions & 16 deletions active_record-acts_as.gemspec
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
# frozen_string_literal: true

require 'active_record/acts_as/version'
require_relative "lib/active_record/acts_as/version"

Gem::Specification.new do |spec|
spec.name = "active_record-acts_as"
spec.version = ActiveRecord::ActsAs::VERSION
spec.authors = ["Hassan Zamani", "Manuel Meurer", "Chedli Bourguiba"]
spec.email = ["[email protected]", "[email protected]", "[email protected]"]
spec.email = ["[email protected]"]
spec.summary = %q{Simulate multi-table inheritance for activerecord models}
spec.description = %q{Simulate multi-table inheritance for activerecord models using a polymorphic association}
spec.homepage = "http://github.com/chaadow/active_record-acts_as"
spec.metadata = { "source_code_uri" => "http://github.com/chaadow/active_record-acts_as" }
spec.metadata = {
"homepage_uri" => "http://github.com/chaadow/active_record-acts_as",
"source_code_uri" => "http://github.com/chaadow/active_record-acts_as",
"changelog_uri" => "http://github.com/chaadow/active_record-acts_as/blob/master/CHANGELOG.md",
"bug_tracker_uri" => "http://github.com/chaadow/active_record-acts_as/issues"
}
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.files = Dir["README.md", "MIT-LICENSE", "lib/**/*.rb"]

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: "../"
1 change: 1 addition & 0 deletions gemfiles/rails_main.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", github: "rails/rails", branch: "main"
gem "sqlite3"

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
Loading