unidom-action 1.17.9 → 1.17.10

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: 351336aeb6830b9384658babb1ba7bce79b6aaff
4
- data.tar.gz: a7dbf7dfb7c15c7c40fce6d4d01c5ab45f77b73e
3
+ metadata.gz: 4f4429dca92f4d861e59382c2dbc06a0b3f0ba39
4
+ data.tar.gz: aa18cf9ddb16e0db40a3bb896872cc96ce3d92d6
5
5
  SHA512:
6
- metadata.gz: a31c4b73fc7750dd1c077d189de2232355fa21e3fea453617c868eb7eb868dbc9cd6da83901db45fb669706cd489205db602e8cd27c3d2bfcfe45b1ded73ba53
7
- data.tar.gz: 55824a3a666171ab984a4e8daffd0a019c67d266c3a01025b944f5d6813f611890f53208c9a139a8b3f89a380313d817ac7bf5ca7ac440ed194f303b9790acb1
6
+ metadata.gz: 47c5dedeb544bdba5eca8a8d7064d40b5ba335cb3beccc29acac0024a6223f69972edd294aa1ec18b2ca17c945a75ef212d587a7b26479a716858cdb737bfc55
7
+ data.tar.gz: 5263111ac423c5dad8406e52f1f21a2d639a61731ea8a25c160e5ef620b40ad746c822e84b139501b80a03e71b1acbada1d5e0ac77188c96fb93cefc8f0a6bbf
data/README.md CHANGED
@@ -265,6 +265,14 @@ class YourCaused < ApplicationRecord
265
265
 
266
266
  end
267
267
 
268
+ # app/models/your_obsolesced.rb
269
+ class YourObsolesced < ApplicationRecord
270
+
271
+ include Unidom::Common::Concerns::ModelExtension
272
+ include Unidom::Action::Concerns::AsObsolesced
273
+
274
+ end
275
+
268
276
  # spec/support/unidom_rspec_shared_examples.rb
269
277
  require 'unidom/action/rspec_shared_examples'
270
278
 
@@ -272,6 +280,7 @@ require 'unidom/action/rspec_shared_examples'
272
280
  describe YourActed, type: :model do
273
281
 
274
282
  model_attribtues = {
283
+ your_attribute: 'your value'
275
284
  }
276
285
 
277
286
  it_behaves_like 'Unidom::Action::Concerns::AsActed', model_attribtues
@@ -282,6 +291,7 @@ end
282
291
  describe YourActorParty, type: :model do
283
292
 
284
293
  model_attribtues = {
294
+ your_attribute: 'your value'
285
295
  }
286
296
 
287
297
  it_behaves_like 'Unidom::Action::Concerns::AsActorParty', model_attribtues
@@ -292,9 +302,21 @@ end
292
302
  describe YourCaused, type: :model do
293
303
 
294
304
  model_attribtues = {
305
+ your_attribute: 'your value'
295
306
  }
296
307
 
297
308
  it_behaves_like 'Unidom::Action::Concerns::AsCaused', model_attribtues
298
309
 
310
+ end
311
+
312
+ # spec/models/your_obsolesced_spec.rb
313
+ describe YourObsolesced, type: :model do
314
+
315
+ model_attribtues = {
316
+ your_attribute: 'your value'
317
+ }
318
+
319
+ it_behaves_like 'Unidom::Action::Concerns::AsObsolesced', model_attribtues
320
+
299
321
  end
300
322
  ```
@@ -1,13 +1,18 @@
1
1
  module Unidom::Action::Concerns::AsObsolesced
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 :obsolescings, class_name: 'Unidom::Action::Obsolescing', as: :obsolesced
8
9
 
9
10
  def is_obsolesced!(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now)
11
+
12
+ assert_present! :obsolescence_code, obsolescence_code
13
+
10
14
  obsolescings.create! obsolescence_code: 'OBSL', obsolescer_visitor: via, obsolescer_party: by, reason: due_to, opened_at: at
15
+
11
16
  end
12
17
 
13
18
  def is_obsolesced?(obsolescence_code: 'OBSL', due_to: nil, via: nil, by: nil, at: Time.now)
@@ -1,21 +1,25 @@
1
1
  shared_examples 'Unidom::Action::Concerns::AsActed' do |model_attributes|
2
2
 
3
- acting_1_attributes = {
4
- actor_visitor_id: SecureRandom.uuid,
5
- actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
6
- actor_party_id: SecureRandom.uuid,
7
- actor_party_type: 'Unidom::Action::ActorParty::Mock',
8
- reason_id: SecureRandom.uuid
9
- }
3
+ context do
10
4
 
11
- acting_2_attributes = {
12
- actor_visitor_id: SecureRandom.uuid,
13
- actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
14
- actor_party_id: SecureRandom.uuid,
15
- actor_party_type: 'Unidom::Action::ActorParty::Mock',
16
- reason_id: SecureRandom.uuid
17
- }
5
+ acting_1_attributes = {
6
+ actor_visitor_id: SecureRandom.uuid,
7
+ actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
8
+ actor_party_id: SecureRandom.uuid,
9
+ actor_party_type: 'Unidom::Action::ActorParty::Mock',
10
+ reason_id: SecureRandom.uuid
11
+ }
18
12
 
19
- it_behaves_like 'has_many', model_attributes, :actings, Unidom::Action::Acting, [ acting_1_attributes, acting_2_attributes ]
13
+ acting_2_attributes = {
14
+ actor_visitor_id: SecureRandom.uuid,
15
+ actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
16
+ actor_party_id: SecureRandom.uuid,
17
+ actor_party_type: 'Unidom::Action::ActorParty::Mock',
18
+ reason_id: SecureRandom.uuid
19
+ }
20
+
21
+ it_behaves_like 'has_many', model_attributes, :actings, Unidom::Action::Acting, [ acting_1_attributes, acting_2_attributes ]
22
+
23
+ end
20
24
 
21
25
  end
@@ -1,21 +1,25 @@
1
1
  shared_examples 'Unidom::Action::Concerns::AsActorParty' do |model_attributes|
2
2
 
3
- acting_1_attributes = {
4
- acted_id: SecureRandom.uuid,
5
- acted_type: 'Unidom::Action::Acted::Mock',
6
- actor_visitor_id: SecureRandom.uuid,
7
- actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
8
- reason_id: SecureRandom.uuid
9
- }
3
+ context do
10
4
 
11
- acting_2_attributes = {
12
- acted_id: SecureRandom.uuid,
13
- acted_type: 'Unidom::Action::Acted::Mock',
14
- actor_visitor_id: SecureRandom.uuid,
15
- actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
16
- reason_id: SecureRandom.uuid
17
- }
5
+ acting_1_attributes = {
6
+ acted_id: SecureRandom.uuid,
7
+ acted_type: 'Unidom::Action::Acted::Mock',
8
+ actor_visitor_id: SecureRandom.uuid,
9
+ actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
10
+ reason_id: SecureRandom.uuid
11
+ }
18
12
 
19
- it_behaves_like 'has_many', model_attributes, :acted_actings, Unidom::Action::Acting, [ acting_1_attributes, acting_2_attributes ]
13
+ acting_2_attributes = {
14
+ acted_id: SecureRandom.uuid,
15
+ acted_type: 'Unidom::Action::Acted::Mock',
16
+ actor_visitor_id: SecureRandom.uuid,
17
+ actor_visitor_type: 'Unidom::Action::ActorVisitor::Mock',
18
+ reason_id: SecureRandom.uuid
19
+ }
20
+
21
+ it_behaves_like 'has_many', model_attributes, :acted_actings, Unidom::Action::Acting, [ acting_1_attributes, acting_2_attributes ]
22
+
23
+ end
20
24
 
21
25
  end
@@ -0,0 +1,29 @@
1
+ shared_examples 'Unidom::Action::Concerns::AsObsolesced' do |model_attributes|
2
+
3
+ context do
4
+
5
+ obsolescing_1_attributes = {
6
+ obsolescer_visitor_id: SecureRandom.uuid,
7
+ obsolescer_visitor_type: 'Unidom::Action::ObsolescerVisitor::Mock',
8
+ obsolescer_party_id: SecureRandom.uuid,
9
+ obsolescer_party_type: 'Unidom::Action::ObsolescerParty::Mock',
10
+ obsolesced_id: SecureRandom.uuid,
11
+ obsolesced_type: 'Unidom::Action::Obsolesced::Mock',
12
+ reason_id: SecureRandom.uuid
13
+ }
14
+
15
+ obsolescing_2_attributes = {
16
+ obsolescer_visitor_id: SecureRandom.uuid,
17
+ obsolescer_visitor_type: 'Unidom::Action::ObsolescerVisitor::Mock',
18
+ obsolescer_party_id: SecureRandom.uuid,
19
+ obsolescer_party_type: 'Unidom::Action::ObsolescerParty::Mock',
20
+ obsolesced_id: SecureRandom.uuid,
21
+ obsolesced_type: 'Unidom::Action::Obsolesced::Mock',
22
+ reason_id: SecureRandom.uuid
23
+ }
24
+
25
+ it_behaves_like 'has_many', model_attributes, :obsolescings, Unidom::Action::Obsolescing, [ obsolescing_1_attributes, obsolescing_2_attributes ]
26
+
27
+ end
28
+
29
+ end
@@ -1,3 +1,4 @@
1
1
  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
+ require 'rspec/models/unidom/action/concerns/as_obsolesced_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '1.17.9'.freeze
3
+ VERSION = '1.17.10'.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.9
4
+ version: 1.17.10
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-03 00:00:00.000000000 Z
11
+ date: 2017-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -72,6 +72,7 @@ files:
72
72
  - lib/rspec/models/unidom/action/concerns/as_acted_shared_examples.rb
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
+ - lib/rspec/models/unidom/action/concerns/as_obsolesced_shared_examples.rb
75
76
  - lib/rspec/models/unidom/action/obsolescing_spec.rb
76
77
  - lib/rspec/models/unidom/action/reason_spec.rb
77
78
  - lib/rspec/models/unidom/action/searching_spec.rb