unidom-party 1.9.1 → 1.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/unidom/party/party_relation.rb +0 -3
- data/lib/rspec/models/unidom/party/collaborating_spec.rb +19 -0
- data/lib/rspec/models/unidom/party/company_spec.rb +19 -0
- data/lib/rspec/models/unidom/party/government_agency_spec.rb +19 -0
- data/lib/rspec/models/unidom/party/party_relation_spec.rb +15 -0
- data/lib/rspec/models/unidom/party/person_spec.rb +18 -20
- data/lib/rspec/models/unidom/party/shop_spec.rb +19 -0
- data/lib/unidom/party/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65fcbac3709241e80c6ff50857f6eff37953030b
|
4
|
+
data.tar.gz: a393f089613fb2daab949663d8f7f295c32f8140
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cca854bb346408cd21c5a0f20a4e1d9b82fd9b43cf05b4bf85277d50b5d94c150cdcf111e339e7b39e0dd70e348e3a6dcc7eb5c92ec2196fe36de21bcf9ab0d
|
7
|
+
data.tar.gz: '09da8d67501081fdd8819b8e0e380a5801962183607cc9817876c63858d62e8f68021b2cf80db5890e5022b2300868892acc9676be1c1c193f1026b44c988fc0'
|
@@ -7,9 +7,6 @@ class Unidom::Party::PartyRelation < Unidom::Party::ApplicationRecord
|
|
7
7
|
|
8
8
|
include Unidom::Common::Concerns::ModelExtension
|
9
9
|
|
10
|
-
#validates :grade, presence: true, numericality: { integer_only: true }
|
11
|
-
#validates :priority, presence: true, numericality: { integer_only: true }
|
12
|
-
|
13
10
|
belongs_to :source_party, polymorphic: true
|
14
11
|
belongs_to :target_party, polymorphic: true
|
15
12
|
|
@@ -19,8 +19,27 @@ describe Unidom::Party::Collaborating, type: :model do
|
|
19
19
|
grade: 5
|
20
20
|
}
|
21
21
|
|
22
|
+
name_max_length = described_class.columns_hash['name'].limit
|
23
|
+
|
22
24
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
23
25
|
|
26
|
+
it_behaves_like 'validates', model_attributes, :name,
|
27
|
+
{ } => 0,
|
28
|
+
{ name: nil } => 2,
|
29
|
+
{ name: '' } => 2,
|
30
|
+
{ name: '1' } => 1,
|
31
|
+
{ name: 'A' } => 1,
|
32
|
+
{ name: '11' } => 0,
|
33
|
+
{ name: 'AA' } => 0,
|
34
|
+
{ name: '111' } => 0,
|
35
|
+
{ name: 'AAA' } => 0,
|
36
|
+
{ name: '1'*(name_max_length-1) } => 0,
|
37
|
+
{ name: 'A'*(name_max_length-1) } => 0,
|
38
|
+
{ name: '1'*name_max_length } => 0,
|
39
|
+
{ name: 'A'*name_max_length } => 0,
|
40
|
+
{ name: '1'*(name_max_length+1) } => 1,
|
41
|
+
{ name: 'A'*(name_max_length+1) } => 1
|
42
|
+
|
24
43
|
end
|
25
44
|
|
26
45
|
end
|
@@ -12,8 +12,27 @@ describe Unidom::Party::Company, type: :model do
|
|
12
12
|
name: 'Tesla'
|
13
13
|
}
|
14
14
|
|
15
|
+
name_max_length = described_class.columns_hash['name'].limit
|
16
|
+
|
15
17
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
18
|
|
19
|
+
it_behaves_like 'validates', model_attributes, :name,
|
20
|
+
{ } => 0,
|
21
|
+
{ name: nil } => 2,
|
22
|
+
{ name: '' } => 2,
|
23
|
+
{ name: '1' } => 1,
|
24
|
+
{ name: 'A' } => 1,
|
25
|
+
{ name: '11' } => 0,
|
26
|
+
{ name: 'AA' } => 0,
|
27
|
+
{ name: '111' } => 0,
|
28
|
+
{ name: 'AAA' } => 0,
|
29
|
+
{ name: '1'*(name_max_length-1) } => 0,
|
30
|
+
{ name: 'A'*(name_max_length-1) } => 0,
|
31
|
+
{ name: '1'*name_max_length } => 0,
|
32
|
+
{ name: 'A'*name_max_length } => 0,
|
33
|
+
{ name: '1'*(name_max_length+1) } => 1,
|
34
|
+
{ name: 'A'*(name_max_length+1) } => 1
|
35
|
+
|
17
36
|
end
|
18
37
|
|
19
38
|
end
|
@@ -15,8 +15,27 @@ describe Unidom::Party::GovernmentAgency, type: :model do
|
|
15
15
|
function_code: 'ZZZZ'
|
16
16
|
}
|
17
17
|
|
18
|
+
name_max_length = described_class.columns_hash['name'].limit
|
19
|
+
|
18
20
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
19
21
|
|
22
|
+
it_behaves_like 'validates', model_attributes, :name,
|
23
|
+
{ } => 0,
|
24
|
+
{ name: nil } => 2,
|
25
|
+
{ name: '' } => 2,
|
26
|
+
{ name: '1' } => 1,
|
27
|
+
{ name: 'A' } => 1,
|
28
|
+
{ name: '11' } => 0,
|
29
|
+
{ name: 'AA' } => 0,
|
30
|
+
{ name: '111' } => 0,
|
31
|
+
{ name: 'AAA' } => 0,
|
32
|
+
{ name: '1'*(name_max_length-1) } => 0,
|
33
|
+
{ name: 'A'*(name_max_length-1) } => 0,
|
34
|
+
{ name: '1'*name_max_length } => 0,
|
35
|
+
{ name: 'A'*name_max_length } => 0,
|
36
|
+
{ name: '1'*(name_max_length+1) } => 1,
|
37
|
+
{ name: 'A'*(name_max_length+1) } => 1
|
38
|
+
|
20
39
|
end
|
21
40
|
|
22
41
|
end
|
@@ -26,6 +26,21 @@ describe Unidom::Party::PartyRelation, type: :model do
|
|
26
26
|
it_behaves_like 'belongs_to', friendship_attributes.merge({ source_party_id: Unidom::Common::NULL_UUID, source_party_type: 'Unidom::Party::Person' }),
|
27
27
|
:target_party, Unidom::Party::Person, tom_attributes
|
28
28
|
|
29
|
+
=begin
|
30
|
+
model_attributes = {
|
31
|
+
source_party_id: SecureRandom.uuid,
|
32
|
+
source_party_type: 'Unidom::Party::Person',
|
33
|
+
target_party_id: SecureRandom.uuid,
|
34
|
+
target_party_type: 'Unidom::Party::Person',
|
35
|
+
linkage_code: 'FRND',
|
36
|
+
priority: 1,
|
37
|
+
grade: 5
|
38
|
+
}
|
39
|
+
|
40
|
+
it_behaves_like 'polymorphic scope', model_attributes, :source_party_is, :source_party, [ Unidom::Party::Company, Unidom::Party::GovernmentAgency, Unidom::Party::Person, Unidom::Party::Shop ]
|
41
|
+
it_behaves_like 'polymorphic scope', model_attributes, :target_party_is, :target_party, [ Unidom::Party::Company, Unidom::Party::GovernmentAgency, Unidom::Party::Person, Unidom::Party::Shop ]
|
42
|
+
=end
|
43
|
+
|
29
44
|
end
|
30
45
|
|
31
46
|
end
|
@@ -6,35 +6,33 @@ describe Unidom::Party::Person, type: :model do
|
|
6
6
|
after :each do
|
7
7
|
end
|
8
8
|
|
9
|
-
context
|
9
|
+
context do
|
10
|
+
|
11
|
+
model_attributes = {
|
12
|
+
name: 'Tim'
|
13
|
+
}
|
10
14
|
|
11
|
-
|
15
|
+
name_max_length = described_class.columns_hash['name'].limit
|
16
|
+
|
17
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
18
|
+
it_behaves_like 'Unidom::Party::Concerns::AsSourceParty', model_attributes
|
12
19
|
|
13
20
|
it_behaves_like 'validates', model_attributes, :name,
|
14
21
|
{ } => 0,
|
15
22
|
{ name: nil } => 2,
|
16
23
|
{ name: '' } => 2,
|
24
|
+
{ name: '1' } => 1,
|
17
25
|
{ name: 'A' } => 1,
|
26
|
+
{ name: '11' } => 0,
|
18
27
|
{ name: 'AA' } => 0,
|
28
|
+
{ name: '111' } => 0,
|
19
29
|
{ name: 'AAA' } => 0,
|
20
|
-
{ name: '
|
21
|
-
{ name: '
|
22
|
-
{ name: '
|
23
|
-
{ name:
|
24
|
-
{ name: '
|
25
|
-
{ name: 'A'*
|
26
|
-
{ name: 'A'*(described_class.columns_hash['name'].limit+1) } => 1
|
27
|
-
|
28
|
-
end
|
29
|
-
|
30
|
-
context do
|
31
|
-
|
32
|
-
model_attributes = {
|
33
|
-
name: 'Tim'
|
34
|
-
}
|
35
|
-
|
36
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
37
|
-
it_behaves_like 'Unidom::Party::Concerns::AsSourceParty', model_attributes
|
30
|
+
{ name: '1'*(name_max_length-1) } => 0,
|
31
|
+
{ name: 'A'*(name_max_length-1) } => 0,
|
32
|
+
{ name: '1'*name_max_length } => 0,
|
33
|
+
{ name: 'A'*name_max_length } => 0,
|
34
|
+
{ name: '1'*(name_max_length+1) } => 1,
|
35
|
+
{ name: 'A'*(name_max_length+1) } => 1
|
38
36
|
|
39
37
|
end
|
40
38
|
|
@@ -12,8 +12,27 @@ describe Unidom::Party::Shop, type: :model do
|
|
12
12
|
name: 'WalMart'
|
13
13
|
}
|
14
14
|
|
15
|
+
name_max_length = described_class.columns_hash['name'].limit
|
16
|
+
|
15
17
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
18
|
|
19
|
+
it_behaves_like 'validates', model_attributes, :name,
|
20
|
+
{ } => 0,
|
21
|
+
{ name: nil } => 2,
|
22
|
+
{ name: '' } => 2,
|
23
|
+
{ name: '1' } => 1,
|
24
|
+
{ name: 'A' } => 1,
|
25
|
+
{ name: '11' } => 0,
|
26
|
+
{ name: 'AA' } => 0,
|
27
|
+
{ name: '111' } => 0,
|
28
|
+
{ name: 'AAA' } => 0,
|
29
|
+
{ name: '1'*(name_max_length-1) } => 0,
|
30
|
+
{ name: 'A'*(name_max_length-1) } => 0,
|
31
|
+
{ name: '1'*name_max_length } => 0,
|
32
|
+
{ name: 'A'*name_max_length } => 0,
|
33
|
+
{ name: '1'*(name_max_length+1) } => 1,
|
34
|
+
{ name: 'A'*(name_max_length+1) } => 1
|
35
|
+
|
17
36
|
end
|
18
37
|
|
19
38
|
end
|
data/lib/unidom/party/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-party
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
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-
|
11
|
+
date: 2017-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|