unidom-action 1.17.15 → 1.17.16
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12c9dbae30d0111e2cf451d744ec603c2aad8dd7
|
4
|
+
data.tar.gz: 24982c865d56fa7408e4d030f78fa9998ae4914a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c14cce7398720cada3f7bc3bda1248e2357afff278b848b329cc52875250fbd274e8876348f0830ee9f2b70dead3fc558424f24ee26b869bcf35e3d7963f73b5
|
7
|
+
data.tar.gz: af8b1d7a95a4974bff64916c9e8266f6fb4d1e4ccbd12d3090424fcede19661b0975d54bf48c39af11d69e021705e7d0ed77526503432da0871f3af3bd1dc86a
|
data/README.md
CHANGED
@@ -329,77 +329,111 @@ end
|
|
329
329
|
# spec/models/your_actor_party_spec.rb
|
330
330
|
describe YourActorParty, type: :model do
|
331
331
|
|
332
|
-
|
333
|
-
|
334
|
-
|
332
|
+
context do
|
333
|
+
|
334
|
+
model_attribtues = {
|
335
|
+
your_attribute: 'your value'
|
336
|
+
}
|
337
|
+
|
338
|
+
acted_attributes = {}
|
339
|
+
acted = Unidom::Visitor::User.create! acted_attributes
|
340
|
+
|
341
|
+
actor_visitor_attributes = {}
|
342
|
+
actor_visitor = Unidom::Visitor::User.create! actor_visitor_attributes
|
335
343
|
|
336
|
-
|
344
|
+
it_behaves_like 'Unidom::Action::Concerns::AsActorParty', model_attributes, acted, actor_visitor
|
345
|
+
|
346
|
+
end
|
337
347
|
|
338
348
|
end
|
339
349
|
|
340
350
|
# spec/models/your_caused_spec.rb
|
341
351
|
describe YourCaused, type: :model do
|
342
352
|
|
343
|
-
|
344
|
-
your_attribute: 'your value'
|
345
|
-
}
|
353
|
+
context do
|
346
354
|
|
347
|
-
|
355
|
+
model_attribtues = {
|
356
|
+
your_attribute: 'your value'
|
357
|
+
}
|
358
|
+
|
359
|
+
it_behaves_like 'Unidom::Action::Concerns::AsCaused', model_attribtues
|
360
|
+
|
361
|
+
end
|
348
362
|
|
349
363
|
end
|
350
364
|
|
351
365
|
# spec/models/your_obsolesced_spec.rb
|
352
366
|
describe YourObsolesced, type: :model do
|
353
367
|
|
354
|
-
|
355
|
-
|
356
|
-
|
368
|
+
context do
|
369
|
+
|
370
|
+
model_attribtues = {
|
371
|
+
your_attribute: 'your value'
|
372
|
+
}
|
357
373
|
|
358
|
-
|
374
|
+
it_behaves_like 'Unidom::Action::Concerns::AsObsolesced', model_attribtues
|
375
|
+
|
376
|
+
end
|
359
377
|
|
360
378
|
end
|
361
379
|
|
362
380
|
# spec/models/your_obsolescer_party_spec.rb
|
363
381
|
describe YourObsolescerParty, type: :model do
|
364
382
|
|
365
|
-
|
366
|
-
|
367
|
-
|
383
|
+
context do
|
384
|
+
|
385
|
+
model_attribtues = {
|
386
|
+
your_attribute: 'your value'
|
387
|
+
}
|
388
|
+
|
389
|
+
it_behaves_like 'Unidom::Action::Concerns::AsObsolescerParty', model_attribtues
|
368
390
|
|
369
|
-
|
391
|
+
end
|
370
392
|
|
371
393
|
end
|
372
394
|
|
373
395
|
# spec/models/your_searcher_party_spec.rb
|
374
396
|
describe YourSearcherParty, type: :model do
|
375
397
|
|
376
|
-
|
377
|
-
your_attribute: 'your value'
|
378
|
-
}
|
398
|
+
context do
|
379
399
|
|
380
|
-
|
400
|
+
model_attribtues = {
|
401
|
+
your_attribute: 'your value'
|
402
|
+
}
|
403
|
+
|
404
|
+
it_behaves_like 'Unidom::Action::Concerns::AsSearcherParty', model_attribtues
|
405
|
+
|
406
|
+
end
|
381
407
|
|
382
408
|
end
|
383
409
|
|
384
410
|
# spec/models/your_state_subject_spec.rb
|
385
411
|
describe YourStateSubject, type: :model do
|
386
412
|
|
387
|
-
|
388
|
-
your_attribute: 'your value'
|
389
|
-
}
|
413
|
+
context do
|
390
414
|
|
391
|
-
|
415
|
+
model_attribtues = {
|
416
|
+
your_attribute: 'your value'
|
417
|
+
}
|
418
|
+
|
419
|
+
it_behaves_like 'Unidom::Action::Concerns::AsStateSubject', model_attribtues
|
420
|
+
|
421
|
+
end
|
392
422
|
|
393
423
|
end
|
394
424
|
|
395
425
|
# spec/models/your_state_transitor_party_spec.rb
|
396
426
|
describe YourAsStateTransitorParty, type: :model do
|
397
427
|
|
398
|
-
|
399
|
-
your_attribute: 'your value'
|
400
|
-
}
|
428
|
+
context do
|
401
429
|
|
402
|
-
|
430
|
+
model_attribtues = {
|
431
|
+
your_attribute: 'your value'
|
432
|
+
}
|
433
|
+
|
434
|
+
it_behaves_like 'Unidom::Action::Concerns::YourAsStateTransitorParty', model_attribtues
|
435
|
+
|
436
|
+
end
|
403
437
|
|
404
438
|
end
|
405
439
|
```
|
@@ -1,13 +1,21 @@
|
|
1
1
|
module Unidom::Action::Concerns::AsActorParty
|
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 :acted_actings, class_name: 'Unidom::Action::Acting', as: :actor_party
|
8
9
|
|
9
10
|
def act!(on: nil, from: nil, thru: nil, due_to: nil, via: nil, at: Time.now, action_code: 'C')
|
11
|
+
|
12
|
+
assert_present! :on, on
|
13
|
+
assert_present! :via, via
|
14
|
+
assert_present! :at, at
|
15
|
+
assert_present! :action_code, action_code
|
16
|
+
|
10
17
|
acted_actings.create! acted: on, from_value: from, thru_value: thru, reason: due_to, actor_visitor: via, opened_at: at, action_code: action_code
|
18
|
+
|
11
19
|
end
|
12
20
|
|
13
21
|
def act?(on: nil, due_to: nil, via: nil, at: Time.now, action_code: 'C')
|
@@ -1,4 +1,4 @@
|
|
1
|
-
shared_examples 'Unidom::Action::Concerns::AsActorParty' do |model_attributes|
|
1
|
+
shared_examples 'Unidom::Action::Concerns::AsActorParty' do |model_attributes, acted, actor_visitor|
|
2
2
|
|
3
3
|
context do
|
4
4
|
|
@@ -20,6 +20,11 @@ shared_examples 'Unidom::Action::Concerns::AsActorParty' do |model_attributes|
|
|
20
20
|
|
21
21
|
it_behaves_like 'has_many', model_attributes, :acted_actings, Unidom::Action::Acting, [ acting_1_attributes, acting_2_attributes ]
|
22
22
|
|
23
|
+
model = described_class.create! model_attributes
|
24
|
+
it_behaves_like 'assert_present!', model, :act!, [ { on: acted, from: nil, thru: nil, due_to: nil, via: actor_visitor, at: Time.now, action_code: 'C' } ], [ :on, :via, :at, :action_code ]
|
25
|
+
it_behaves_like 'assert_present!', model, :act!, [ { on: acted, from: {}, thru: {}, due_to: nil, via: actor_visitor, at: Time.now, action_code: 'C' } ], [ :on, :via, :at, :action_code ]
|
26
|
+
it_behaves_like 'assert_present!', model, :act!, [ { on: acted, from: { key_1: 'value_1' }, thru: { key_1: 'value_2' }, due_to: nil, via: actor_visitor, at: Time.now, action_code: 'C' } ], [ :on, :via, :at, :action_code ]
|
27
|
+
|
23
28
|
end
|
24
29
|
|
25
30
|
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.
|
4
|
+
version: 1.17.16
|
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-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|