unidom-action 1.17.10 → 1.17.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/app/models/unidom/action/concerns/as_obsolesced.rb +1 -0
- data/app/models/unidom/action/concerns/as_obsolescer_party.rb +6 -1
- data/lib/rspec/models/unidom/action/concerns/as_obsolescer_party_shared_examples.rb +27 -0
- data/lib/unidom/action/rspec_shared_examples.rb +1 -0
- data/lib/unidom/action/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: de8f2a642094e0e262ff38b71b20a41cabcb9993
|
|
4
|
+
data.tar.gz: 1ba43eaf774be29deb1bd42b08aa455f5f429a4c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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'
|
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.
|
|
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
|
+
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
|