subroutine 2.1.0 → 2.1.1

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: be1eef70ae231ae5b344cf1400ed9ea17a60df49fd1243eb744c13e4aca5904e
4
- data.tar.gz: 21f60843110c2b5f6c70281dc1999ed84923848f805cbd08472cb7a863a00a59
3
+ metadata.gz: 359d2ea93dea5768e77277086229a0dd6e38c90c6f05866e443980a45afd98f9
4
+ data.tar.gz: a1282dec003600a234fd8e8a076570f91813681d4eb3afdd84c4193ad8b115bf
5
5
  SHA512:
6
- metadata.gz: 3cb5596227a06ddfdcca54205bb0c599919ffae5f29ef30ab25d437e7cf8cb03462c99015c957fdfce8d2a7a3ed910b013da7e84f6516a9f37a34a44fa44734b
7
- data.tar.gz: 141e1f223f7da3dc7d080cbc891cd9533a905833ceb8a85e0941b06b6455cf83dea42aabe9f3eeaf977966ea227ead94446462c86ad28261b37436b389152c45
6
+ metadata.gz: e01d4ab80fce0047950af6511d5b626e740f1a7e1157e283f09a911dbeaab21af01ae5b173c750e7078f57c28f058000e428df4eca784e522496cc8053fb2617
7
+ data.tar.gz: 423ddf621546c4d74c1934f476aab6e0da728379490ac7b6d8f0b420b8dde3d101e8a1f0cdb8369908d87dd34fd21ef119627e10c78acd7d88aac8064b65216b
@@ -216,9 +216,9 @@ module Subroutine
216
216
  field_provided?(name) ? all_params[name] : all_default_params[name]
217
217
  end
218
218
 
219
- def set_field(name, value, track_provided: true)
219
+ def set_field(name, value, opts = {})
220
220
  config = get_field_config(name)
221
- @provided_fields[name] = true if track_provided
221
+ @provided_fields[name] = true unless opts[:track_provided] == false
222
222
  value = attempt_cast(value, config) do |e|
223
223
  "Error during assignment of field `#{name}`: #{e}"
224
224
  end
@@ -4,7 +4,7 @@ module Subroutine
4
4
 
5
5
  MAJOR = 2
6
6
  MINOR = 1
7
- PATCH = 0
7
+ PATCH = 1
8
8
  PRE = nil
9
9
 
10
10
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
@@ -136,5 +136,12 @@ module Subroutine
136
136
  assert_equal({}.with_indifferent_access, op.without_inherited_params)
137
137
  end
138
138
 
139
+ def test_fields_are_inherited_to_subclasses
140
+ assert_equal(%i[amount_cents], ParentInheritanceOp.field_configurations.keys.sort)
141
+ assert_equal(%i[debit_cents], ParentInheritanceOp::EarlyInheritanceOp.field_configurations.keys.sort)
142
+ assert_equal(%i[amount_cents debit_cents], ParentInheritanceOp::LateInheritanceOp.field_configurations.keys.sort)
143
+ assert_equal(%i[amount_cents credit_cents], OuterInheritanceOp.field_configurations.keys.sort)
144
+ end
145
+
139
146
  end
140
147
  end
data/test/support/ops.rb CHANGED
@@ -284,10 +284,33 @@ class UnlessConditionalPolicyOp < OpWithAuth
284
284
 
285
285
  end
286
286
 
287
+ class ParentInheritanceOp < ::Subroutine::Op
288
+ class EarlyInheritanceOp < ParentInheritanceOp
289
+ integer :debit_cents
290
+ end
291
+
292
+ integer :amount_cents
293
+
294
+ class LateInheritanceOp < ParentInheritanceOp
295
+ integer :debit_cents
296
+ end
297
+
298
+ end
299
+
300
+ class OuterInheritanceOp < ParentInheritanceOp
301
+
302
+ integer :credit_cents
303
+
304
+ end
305
+
287
306
  class OpWithAssociation < ::Subroutine::Op
288
307
 
289
308
  include ::Subroutine::AssociationFields
290
309
 
310
+ def perform
311
+ false
312
+ end
313
+
291
314
  end
292
315
 
293
316
  class SimpleAssociationOp < ::OpWithAssociation
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subroutine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Nelson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-11 00:00:00.000000000 Z
11
+ date: 2022-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel