unidom-contact 1.4.4 → 1.4.5

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: '08e9ef952f53a815323984ef8c5b678e0b50ff61'
4
- data.tar.gz: 269b15a2fd123f0c732456883f595032dcd1a4ae
3
+ metadata.gz: eeb5f1c95cfacf6aafe4aed4f93710c0deaac839
4
+ data.tar.gz: 6ead87426500e3622af26a86dee027132c902982
5
5
  SHA512:
6
- metadata.gz: bfa389fdf890944625a218bcbd9a93317bcc801fffc04878aaa2ff0ee080a3d64a4f6ef10bfcf106ecd2f9403e297d8eb05fb873972fba1015fe98e47bebdad6
7
- data.tar.gz: 2651a1669a8ec17908b52379014496db35b3c46bc17fba939a87ea862047f0918e9338c85f32b550ba5127c019428007ac42fbe46cfb5b039be96636121e2f4c
6
+ metadata.gz: de4bce6fcab860772a4c9f87e285052ac5622a1d3cf63ac6711b642b6ea07e84008738e35dc599928d136f30a6e78768916a5bdbb190864c0d2a340b8a2b1533
7
+ data.tar.gz: 0b1f53691c5d41957d0804bfd7d1def2c3f3761cc4b0763212f3a432d413ace17326cc7cec1f7c044af7f48da97f2207630ad1e9752a3fb4b103822ddcf9de53
@@ -1,21 +1,25 @@
1
1
  shared_examples 'Unidom::Contact::Concerns::AsContact' do |model_attributes|
2
2
 
3
- contact_subscription_1_attribtues = {
4
- subscriber_id: SecureRandom.uuid,
5
- subscriber_type: 'Unidom::Contact::Subscriber::Mock',
6
- name: 'Name #1',
7
- grade: 5,
8
- priority: 2
9
- }
3
+ context do
10
4
 
11
- contact_subscription_2_attribtues = {
12
- subscriber_id: SecureRandom.uuid,
13
- subscriber_type: 'Unidom::Contact::Subscriber::Mock',
14
- name: 'Name #2',
15
- grade: 2,
16
- priority: 4
17
- }
5
+ contact_subscription_1_attribtues = {
6
+ subscriber_id: SecureRandom.uuid,
7
+ subscriber_type: 'Unidom::Contact::Subscriber::Mock',
8
+ name: 'Name #1',
9
+ grade: 5,
10
+ priority: 2
11
+ }
18
12
 
19
- it_behaves_like 'has_many', model_attributes, :contact_subscriptions, Unidom::Contact::ContactSubscription, [ contact_subscription_1_attribtues, contact_subscription_2_attribtues ]
13
+ contact_subscription_2_attribtues = {
14
+ subscriber_id: SecureRandom.uuid,
15
+ subscriber_type: 'Unidom::Contact::Subscriber::Mock',
16
+ name: 'Name #2',
17
+ grade: 2,
18
+ priority: 4
19
+ }
20
+
21
+ it_behaves_like 'has_many', model_attributes, :contact_subscriptions, Unidom::Contact::ContactSubscription, [ contact_subscription_1_attribtues, contact_subscription_2_attribtues ]
22
+
23
+ end
20
24
 
21
25
  end
@@ -1,21 +1,25 @@
1
1
  shared_examples 'Unidom::Contact::Concerns::AsSubscriber' do |model_attributes|
2
2
 
3
- contact_subscription_1_attribtues = {
4
- contact_id: SecureRandom.uuid,
5
- contact_type: 'Unidom::Contact::Contact::Mock',
6
- name: 'Name #1',
7
- grade: 5,
8
- priority: 2
9
- }
3
+ context do
10
4
 
11
- contact_subscription_2_attribtues = {
12
- contact_id: SecureRandom.uuid,
13
- contact_type: 'Unidom::Contact::Contact::Mock',
14
- name: 'Name #2',
15
- grade: 2,
16
- priority: 4
17
- }
5
+ contact_subscription_1_attribtues = {
6
+ contact_id: SecureRandom.uuid,
7
+ contact_type: 'Unidom::Contact::Contact::Mock',
8
+ name: 'Name #1',
9
+ grade: 5,
10
+ priority: 2
11
+ }
18
12
 
19
- it_behaves_like 'has_many', model_attributes, :contact_subscriptions, Unidom::Contact::ContactSubscription, [ contact_subscription_1_attribtues, contact_subscription_2_attribtues ]
13
+ contact_subscription_2_attribtues = {
14
+ contact_id: SecureRandom.uuid,
15
+ contact_type: 'Unidom::Contact::Contact::Mock',
16
+ name: 'Name #2',
17
+ grade: 2,
18
+ priority: 4
19
+ }
20
+
21
+ it_behaves_like 'has_many', model_attributes, :contact_subscriptions, Unidom::Contact::ContactSubscription, [ contact_subscription_1_attribtues, contact_subscription_2_attribtues ]
22
+
23
+ end
20
24
 
21
25
  end
@@ -16,20 +16,10 @@ describe Unidom::Contact::ContactSubscription, type: :model do
16
16
  name: 'Home'
17
17
  }
18
18
 
19
- name_max_length = described_class.columns_hash['name'].limit
20
-
21
19
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
22
20
 
23
- it_behaves_like 'validates', model_attributes, :name,
24
- { } => 0,
25
- { name: nil } => 2,
26
- { name: '' } => 2,
27
- { name: 'A' } => 1,
28
- { name: 'Al' } => 0,
29
- { name: 'Bob' } => 0,
30
- { name: 'A'*(name_max_length-1) } => 0,
31
- { name: 'A'*name_max_length } => 0,
32
- { name: 'A'*(name_max_length+1) } => 1
21
+ it_behaves_like 'validates text', model_attributes, :name,
22
+ length: 2..described_class.columns_hash['name'].limit
33
23
 
34
24
  email_address_attributes = {
35
25
  personalized_name: 'Tim Jason',
@@ -17,7 +17,6 @@ describe Unidom::Contact::EmailAddress, type: :model do
17
17
  it_behaves_like 'Unidom::Contact::Concerns::AsContact', model_attributes
18
18
 
19
19
  full_address_max_length = described_class.columns_hash['full_address'].limit
20
-
21
20
  it_behaves_like 'validates', model_attributes, :full_address,
22
21
  { } => 0,
23
22
  { full_address: nil } => 2,
@@ -33,6 +32,22 @@ describe Unidom::Contact::EmailAddress, type: :model do
33
32
  { full_address: "l@#{'c'*(full_address_max_length-5)}.de" } => 0,
34
33
  { full_address: "l@#{'c'*(full_address_max_length-4)}.de" } => 1
35
34
 
35
+ personalized_name_max_length = described_class.columns_hash['personalized_name'].limit
36
+ it_behaves_like 'validates', model_attributes, :personalized_name,
37
+ { } => 0,
38
+ { personalized_name: nil } => 0,
39
+ { personalized_name: '' } => 0,
40
+ { personalized_name: 'l' } => 0,
41
+ { personalized_name: 'l@' } => 0,
42
+ { personalized_name: 'l@d' } => 0,
43
+ { personalized_name: 'l@us' } => 0,
44
+ { personalized_name: 'l@com' } => 0,
45
+ { personalized_name: 'l@jobs' } => 0,
46
+ { personalized_name: 'l@jobs.com.cn' } => 0,
47
+ { personalized_name: 'c'*(personalized_name_max_length-1) } => 0,
48
+ { personalized_name: 'c'*personalized_name_max_length } => 0,
49
+ { personalized_name: 'c'*(personalized_name_max_length+1) } => 1
50
+
36
51
  it_behaves_like 'scope', :full_address_is, [
37
52
  { attributes_collection: [ model_attributes ], count_diff: 1, args: [ model_attributes[:full_address] ] },
38
53
  { attributes_collection: [ model_attributes ], count_diff: 0, args: [ 'tom.king@corporation.com' ] },
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Contact
3
- VERSION = '1.4.4'.freeze
3
+ VERSION = '1.4.5'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-contact
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.5
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-03-24 00:00:00.000000000 Z
11
+ date: 2017-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common