unidom-action 1.17.10 → 1.17.11

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
  SHA1:
3
- metadata.gz: 4f4429dca92f4d861e59382c2dbc06a0b3f0ba39
4
- data.tar.gz: aa18cf9ddb16e0db40a3bb896872cc96ce3d92d6
3
+ metadata.gz: de8f2a642094e0e262ff38b71b20a41cabcb9993
4
+ data.tar.gz: 1ba43eaf774be29deb1bd42b08aa455f5f429a4c
5
5
  SHA512:
6
- metadata.gz: 47c5dedeb544bdba5eca8a8d7064d40b5ba335cb3beccc29acac0024a6223f69972edd294aa1ec18b2ca17c945a75ef212d587a7b26479a716858cdb737bfc55
7
- data.tar.gz: 5263111ac423c5dad8406e52f1f21a2d639a61731ea8a25c160e5ef620b40ad746c822e84b139501b80a03e71b1acbada1d5e0ac77188c96fb93cefc8f0a6bbf
6
+ metadata.gz: 53aba026e93db688c5984ab019e912154908a1bb6c26e3f45c18f26ece49a177e86539c6cd501cd5e3f6311ec9a6b9a34db7c3c45d8eda26ea0674e12a6ea02d
7
+ data.tar.gz: 64d2054ddf594fd5c92720928a0f1c6196fad23003ba55f21cc3a0410127be85ba3f2b6ec350d45ab0873ac6e33c4609fe186a3fa5a521ddd224772f73c4010e
data/README.md CHANGED
@@ -273,6 +273,14 @@ class YourObsolesced < ApplicationRecord
273
273
 
274
274
  end
275
275
 
276
+ # app/models/your_obsolescer_party.rb
277
+ class YourObsolescerParty < ApplicationRecord
278
+
279
+ include Unidom::Common::Concerns::ModelExtension
280
+ include Unidom::Action::Concerns::AsObsolescerParty
281
+
282
+ end
283
+
276
284
  # spec/support/unidom_rspec_shared_examples.rb
277
285
  require 'unidom/action/rspec_shared_examples'
278
286
 
@@ -318,5 +326,16 @@ describe YourObsolesced, type: :model do
318
326
 
319
327
  it_behaves_like 'Unidom::Action::Concerns::AsObsolesced', model_attribtues
320
328
 
329
+ end
330
+
331
+ # spec/models/your_obsolescer_party_spec.rb
332
+ describe YourObsolescerParty, type: :model do
333
+
334
+ model_attribtues = {
335
+ your_attribute: 'your value'
336
+ }
337
+
338
+ it_behaves_like 'Unidom::Action::Concerns::AsObsolescerParty', model_attribtues
339
+
321
340
  end
322
341
  ```
@@ -10,6 +10,7 @@ module Unidom::Action::Concerns::AsObsolesced
10
10
  def is_obsolesced!(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now)
11
11
 
12
12
  assert_present! :obsolescence_code, obsolescence_code
13
+ assert_present! :via, via
13
14
 
14
15
  obsolescings.create! obsolescence_code: 'OBSL', obsolescer_visitor: via, obsolescer_party: by, reason: due_to, opened_at: at
15
16
 
@@ -1,13 +1,18 @@
1
1
  module Unidom::Action::Concerns::AsObsolescerParty
2
2
 
3
- extend ActiveSupport::Concern
3
+ extend ActiveSupport::Concern
4
+ include Unidom::Common::Concerns::ArgumentValidation
4
5
 
5
6
  included do |includer|
6
7
 
7
8
  has_many :obsolesced_obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolescer_party
8
9
 
9
10
  def obsolesce!(it, obsolescence_code: 'OBSL', due_to: nil, via: nil, at: Time.now)
11
+
12
+ assert_present! :it, it
13
+
10
14
  obsolesced_obsolescings.create! obsolesced: it, obsolescence_code: 'OBSL', obsolescer_visitor: via, reason: due_to, opened_at: at
15
+
11
16
  end
12
17
 
13
18
  def obsolesce?(it, obsolescence_code: 'OBSL', due_to: nil, via: nil, at: Time.now)
@@ -0,0 +1,27 @@
1
+ shared_examples 'Unidom::Action::Concerns::AsObsolescerParty' do |model_attributes|
2
+
3
+ context do
4
+
5
+ obsolescing_1_attributes = {
6
+ obsolesced_id: SecureRandom.uuid,
7
+ obsolesced_type: 'Unidom::Action::Obsolesced::Mock',
8
+ obsolescer_visitor_id: SecureRandom.uuid,
9
+ obsolescer_visitor_type: 'Unidom::Action::ObsolescerVisitor::Mock',
10
+ reason_id: SecureRandom.uuid,
11
+ obsolescence_code: 'OBSL'
12
+ }
13
+
14
+ obsolescing_2_attributes = {
15
+ obsolesced_id: SecureRandom.uuid,
16
+ obsolesced_type: 'Unidom::Action::Obsolesced::Mock',
17
+ obsolescer_visitor_id: SecureRandom.uuid,
18
+ obsolescer_visitor_type: 'Unidom::Action::ObsolescerVisitor::Mock',
19
+ reason_id: SecureRandom.uuid,
20
+ obsolescence_code: 'RCVR'
21
+ }
22
+
23
+ it_behaves_like 'has_many', model_attributes, :obsolesced_obsolescings, Unidom::Action::Obsolescing, [ obsolescing_1_attributes, obsolescing_2_attributes ]
24
+
25
+ end
26
+
27
+ end
@@ -2,3 +2,4 @@ require 'rspec/models/unidom/action/concerns/as_acted_shared_examples'
2
2
  require 'rspec/models/unidom/action/concerns/as_actor_party_shared_examples'
3
3
  require 'rspec/models/unidom/action/concerns/as_caused_shared_examples'
4
4
  require 'rspec/models/unidom/action/concerns/as_obsolesced_shared_examples'
5
+ require 'rspec/models/unidom/action/concerns/as_obsolescer_party_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '1.17.10'.freeze
3
+ VERSION = '1.17.11'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-action
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.10
4
+ version: 1.17.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Topbit Du
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-11 00:00:00.000000000 Z
11
+ date: 2017-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -73,6 +73,7 @@ files:
73
73
  - lib/rspec/models/unidom/action/concerns/as_actor_party_shared_examples.rb
74
74
  - lib/rspec/models/unidom/action/concerns/as_caused_shared_examples.rb
75
75
  - lib/rspec/models/unidom/action/concerns/as_obsolesced_shared_examples.rb
76
+ - lib/rspec/models/unidom/action/concerns/as_obsolescer_party_shared_examples.rb
76
77
  - lib/rspec/models/unidom/action/obsolescing_spec.rb
77
78
  - lib/rspec/models/unidom/action/reason_spec.rb
78
79
  - lib/rspec/models/unidom/action/searching_spec.rb