active_record-acts_as 5.0.2 → 5.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52d4f9697fffd355665d4fbfec8e95d3df7e4a7f079c1075ec02433003088028
4
- data.tar.gz: 90991fdb687a92ea19ef8c3d1f86f8940079e8adc31a715b0c81a0c64cde8159
3
+ metadata.gz: ecd8cd75c441652a7719cc0b040d77a84a95f30b1ea8b19c02aa35fb6bdcd425
4
+ data.tar.gz: a94c71a0cc0dec6e7468cc3949260ee521320a15ab09d433a7c6323aa8b2114d
5
5
  SHA512:
6
- metadata.gz: 7f387a9c486ad279c7c978bdd58136f34a0b74438d757be8d507c0817da2d7c51f95bfac00223f375942ae511124d63dcfc77970901481d6671d92559166dbfa
7
- data.tar.gz: 17cb390291b18ca97a7778177407694f300dc45fb5717d76410b859018339bf71988fb88c430355aa21ad3910d726f97d5e9f19139c5f86aa8b039d1957876db
6
+ metadata.gz: ea6d3e0caa50e3a5e39543684bf372e4d64d5b8adfeb29686523b6674d7d1f4d42449b924f657814cd2c14894068a019d8a8796c45efcc1a76bc1c8cac0ea886
7
+ data.tar.gz: 9d12820c023f3c0f9d11594b17c904da1ece86fa4381a791cb84f086cde101078140ab9219dfee08185c7e90143d3ae1cffe7abe4f829e427fce002da72c8366
data/.travis.yml CHANGED
@@ -10,3 +10,7 @@ gemfile:
10
10
  - gemfiles/rails_6.0.gemfile
11
11
  - gemfiles/rails_6.1.gemfile
12
12
  - gemfiles/rails_master.gemfile
13
+ jobs:
14
+ exclude:
15
+ - rvm: 2.6
16
+ gemfile: gemfiles/rails_master.gemfile
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  ## [Unreleased] -
8
8
 
9
+ ## [5.0.2] - 2021-07-27
10
+
11
+ ### Fixed
12
+ - Handle kwargs in ruby 3 in methods delegated to supermodel (@tindron)
13
+
9
14
  ## [5.0.1] - 2021-01-28
10
15
 
11
16
  ### Fixed
@@ -30,5 +30,6 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_dependency "activesupport", ">= 6.0"
32
32
  spec.add_dependency "activerecord", ">= 6.0"
33
+ spec.add_dependency "ruby2_keywords"
33
34
 
34
35
  end
@@ -1,3 +1,4 @@
1
+ require 'ruby2_keywords'
1
2
  require 'active_support'
2
3
  require 'active_record'
3
4
  require 'active_record/acts_as/version'
@@ -23,7 +23,7 @@ module ActiveRecord
23
23
  acting_as_model.methods_callable_by_submodel.include?(method) || super
24
24
  end
25
25
 
26
- def method_missing(method, *args, &block)
26
+ ruby2_keywords def method_missing(method, *args, &block)
27
27
  if acting_as_model.methods_callable_by_submodel.include?(method)
28
28
  result = acting_as_model.public_send(method, *args, &block)
29
29
  if result.is_a?(ActiveRecord::Relation)
@@ -117,7 +117,7 @@ module ActiveRecord
117
117
  duplicate
118
118
  end
119
119
 
120
- def method_missing(method, *args, &block)
120
+ ruby2_keywords def method_missing(method, *args, &block)
121
121
  if !self_respond_to?(method) && acting_as.respond_to?(method)
122
122
  acting_as.send(method, *args, &block)
123
123
  else
@@ -1,6 +1,6 @@
1
1
  module ActiveRecord
2
2
  module ActsAs
3
- VERSION = "5.0.2"
3
+ VERSION = "5.0.3"
4
4
  end
5
5
  end
6
6
 
data/spec/acts_as_spec.rb CHANGED
@@ -157,6 +157,10 @@ RSpec.describe "ActiveRecord::Base model with #acts_as called" do
157
157
  expect(pen.present).to eq("pen - $0.8")
158
158
  end
159
159
 
160
+ it "responds to supermodel methods with keyword arguments" do
161
+ expect(pen.keyword_method(one: 3, two: 4)).to eq [3,4]
162
+ end
163
+
160
164
  it 'responds to serialized attribute' do
161
165
  expect(pen).to respond_to('option1')
162
166
  expect(isolated_pen).to respond_to('option2')
@@ -452,6 +456,10 @@ RSpec.describe "ActiveRecord::Base model with #acts_as called" do
452
456
  expect(Product.class_method_callable_by_submodel).to eq('class_method_callable_by_submodel')
453
457
  expect(Pen.class_method_callable_by_submodel).to eq('class_method_callable_by_submodel')
454
458
  end
459
+
460
+ it 'with keyword arguments can be called from the submodel' do
461
+ expect(Pen.class_keyword_method_callable_by_submodel(one: 3, two: 4)).to eq([3,4])
462
+ end
455
463
  end
456
464
 
457
465
  context 'when they are neither defined via `scope` nor made callable by submodel' do
data/spec/models.rb CHANGED
@@ -16,6 +16,10 @@ class Product < ActiveRecord::Base
16
16
  'class_method'
17
17
  end
18
18
 
19
+ callable_by_submodel def self.class_keyword_method_callable_by_submodel(one: 1, two: 2)
20
+ [one, two]
21
+ end
22
+
19
23
  callable_by_submodel def self.class_method_callable_by_submodel
20
24
  'class_method_callable_by_submodel'
21
25
  end
@@ -27,6 +31,10 @@ class Product < ActiveRecord::Base
27
31
  def raise_error
28
32
  specific.non_existant_method
29
33
  end
34
+
35
+ def keyword_method(one: 1, two: 2)
36
+ [one, two]
37
+ end
30
38
  end
31
39
 
32
40
  class Payment < ActiveRecord::Base
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record-acts_as
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hassan Zamani
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-02-09 00:00:00.000000000 Z
13
+ date: 2021-07-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sqlite3
@@ -124,6 +124,20 @@ dependencies:
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '6.0'
127
+ - !ruby/object:Gem::Dependency
128
+ name: ruby2_keywords
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
127
141
  description: Simulate multi-table inheritance for activerecord models using a polymorphic
128
142
  association
129
143
  email: