unidom-action 1.17.14 → 1.17.15
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: 40472468737c8d5cdfff2e459e23b3ebb7d33f6e
|
4
|
+
data.tar.gz: 0260d091a9ca67eaa6969957b12b29e6ecfd26a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b9fba3b3aaad866b7642b15250cd8919b3d95f33f36fc066a596edab513e5cf5756be25c8561343af281b908a1e10405c3557eb46c2cf2bd321d18762c5417c
|
7
|
+
data.tar.gz: 6a0b589343e7b6044e7ad1addb2345c8f414418942c8c2c8e0140f0b8e91499362df332f072769fcaa349c891dbc31eaf1e6aefbf9ec2778ece5c03f2069aa36
|
data/README.md
CHANGED
@@ -311,11 +311,18 @@ require 'unidom/action/rspec_shared_examples'
|
|
311
311
|
# spec/models/your_acted_spec.rb
|
312
312
|
describe YourActed, type: :model do
|
313
313
|
|
314
|
-
|
315
|
-
|
316
|
-
|
314
|
+
context do
|
315
|
+
|
316
|
+
model_attribtues = {
|
317
|
+
your_attribute: 'your value'
|
318
|
+
}
|
319
|
+
|
320
|
+
actor_party = Unidom::Party::Person.create! name: 'Tim'
|
321
|
+
actor_visitor = Unidom::Visitor::User.create!
|
322
|
+
|
323
|
+
it_behaves_like 'Unidom::Action::Concerns::AsActed', model_attributes, actor_party, actor_visitor
|
317
324
|
|
318
|
-
|
325
|
+
end
|
319
326
|
|
320
327
|
end
|
321
328
|
|
@@ -1,13 +1,21 @@
|
|
1
1
|
module Unidom::Action::Concerns::AsActed
|
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 :actings, class_name: 'Unidom::Action::Acting', as: :acted
|
8
9
|
|
9
10
|
def is_acted!(from: nil, thru: nil, due_to: nil, by: nil, via: nil, at: Time.now, action_code: 'C')
|
11
|
+
|
12
|
+
assert_present! :by, by
|
13
|
+
assert_present! :via, via
|
14
|
+
assert_present! :at, at
|
15
|
+
assert_present! :action_code, action_code
|
16
|
+
|
10
17
|
actings.create! from_value: from, thru_value: thru, actor_visitor: via, actor_party: by, acted: self, reason: due_to, action_code: action_code, opened_at: at
|
18
|
+
|
11
19
|
end
|
12
20
|
|
13
21
|
def is_acted?(due_to: nil, by: nil, via: nil, at: Time.now, action_code: 'C')
|
@@ -1,4 +1,4 @@
|
|
1
|
-
shared_examples 'Unidom::Action::Concerns::AsActed' do |model_attributes|
|
1
|
+
shared_examples 'Unidom::Action::Concerns::AsActed' do |model_attributes, actor_party, actor_visitor|
|
2
2
|
|
3
3
|
context do
|
4
4
|
|
@@ -20,6 +20,11 @@ shared_examples 'Unidom::Action::Concerns::AsActed' do |model_attributes|
|
|
20
20
|
|
21
21
|
it_behaves_like 'has_many', model_attributes, :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, :is_acted!, [ { from: nil, thru: nil, due_to: nil, by: actor_party, via: actor_visitor, at: Time.now, action_code: 'C' } ], [ :by, :via, :at, :action_code ]
|
25
|
+
it_behaves_like 'assert_present!', model, :is_acted!, [ { from: {}, thru: {}, due_to: nil, by: actor_party, via: actor_visitor, at: Time.now, action_code: 'C' } ], [ :by, :via, :at, :action_code ]
|
26
|
+
it_behaves_like 'assert_present!', model, :is_acted!, [ { from: { key_1: 'value_1' }, thru: { key_1: 'value_2' }, due_to: nil, by: actor_party, via: actor_visitor, at: Time.now, action_code: 'C' } ], [ :by, :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.15
|
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-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|