unidom-contact 1.4.3 → 1.4.4
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 +49 -0
- data/lib/rspec/models/unidom/contact/concerns/as_contact_shared_examples.rb +21 -0
- data/lib/rspec/models/unidom/contact/concerns/as_subscriber_shared_examples.rb +21 -0
- data/lib/rspec/models/unidom/contact/email_address_spec.rb +1 -0
- data/lib/unidom/contact/rspec_shared_examples.rb +2 -0
- data/lib/unidom/contact/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08e9ef952f53a815323984ef8c5b678e0b50ff61'
|
4
|
+
data.tar.gz: 269b15a2fd123f0c732456883f595032dcd1a4ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfa389fdf890944625a218bcbd9a93317bcc801fffc04878aaa2ff0ee080a3d64a4f6ef10bfcf106ecd2f9403e297d8eb05fb873972fba1015fe98e47bebdad6
|
7
|
+
data.tar.gz: 2651a1669a8ec17908b52379014496db35b3c46bc17fba939a87ea862047f0918e9338c85f32b550ba5127c019428007ac42fbe46cfb5b039be96636121e2f4c
|
data/README.md
CHANGED
@@ -114,6 +114,8 @@ end
|
|
114
114
|
|
115
115
|
## RSpec examples
|
116
116
|
|
117
|
+
### RSpec example manifest (run automatically)
|
118
|
+
|
117
119
|
```ruby
|
118
120
|
# spec/models/unidom_spec.rb
|
119
121
|
require 'unidom/contact/models_rspec'
|
@@ -124,3 +126,50 @@ require 'unidom/contact/types_rspec'
|
|
124
126
|
# spec/validators/unidom_spec.rb
|
125
127
|
require 'unidom/contact/validators_rspec'
|
126
128
|
```
|
129
|
+
|
130
|
+
### RSpec shared examples (to be integrated)
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
# lib/unidom.rb
|
134
|
+
def initialize_unidom
|
135
|
+
|
136
|
+
Unidom::Party::Person.class_eval do
|
137
|
+
include Unidom::Contact::Concerns::AsSubscriber
|
138
|
+
end
|
139
|
+
|
140
|
+
#Unidom::Contact::EmailAddress.class_eval do
|
141
|
+
# include Unidom::Contact::Concerns::AsContact
|
142
|
+
#end
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
# spec/rails_helper.rb
|
147
|
+
require 'unidom'
|
148
|
+
initialize_unidom
|
149
|
+
|
150
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
151
|
+
require 'unidom/contact/rspec_shared_examples'
|
152
|
+
|
153
|
+
# spec/models/unidom/party/person_spec.rb
|
154
|
+
describe Unidom::Party::Person do
|
155
|
+
|
156
|
+
model_attribtues = {
|
157
|
+
name: 'Tim'
|
158
|
+
}
|
159
|
+
|
160
|
+
it_behaves_like 'Unidom::Contact::Concerns::AsSubscriber', model_attribtues
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
# spec/models/unidom/contact/email_address_spec.rb
|
165
|
+
describe Unidom::Position::Post do
|
166
|
+
|
167
|
+
model_attributes = {
|
168
|
+
personalized_name: 'Tim Jason',
|
169
|
+
full_address: 'tim.jason@company.com'
|
170
|
+
}
|
171
|
+
|
172
|
+
it_behaves_like 'Unidom::Contact::Concerns::AsContact', model_attributes
|
173
|
+
|
174
|
+
end
|
175
|
+
```
|
@@ -0,0 +1,21 @@
|
|
1
|
+
shared_examples 'Unidom::Contact::Concerns::AsContact' do |model_attributes|
|
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
|
+
}
|
10
|
+
|
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
|
+
}
|
18
|
+
|
19
|
+
it_behaves_like 'has_many', model_attributes, :contact_subscriptions, Unidom::Contact::ContactSubscription, [ contact_subscription_1_attribtues, contact_subscription_2_attribtues ]
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
shared_examples 'Unidom::Contact::Concerns::AsSubscriber' do |model_attributes|
|
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
|
+
}
|
10
|
+
|
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
|
+
}
|
18
|
+
|
19
|
+
it_behaves_like 'has_many', model_attributes, :contact_subscriptions, Unidom::Contact::ContactSubscription, [ contact_subscription_1_attribtues, contact_subscription_2_attribtues ]
|
20
|
+
|
21
|
+
end
|
@@ -14,6 +14,7 @@ describe Unidom::Contact::EmailAddress, type: :model do
|
|
14
14
|
}
|
15
15
|
|
16
16
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
17
|
+
it_behaves_like 'Unidom::Contact::Concerns::AsContact', model_attributes
|
17
18
|
|
18
19
|
full_address_max_length = described_class.columns_hash['full_address'].limit
|
19
20
|
|
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
|
+
version: 1.4.4
|
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-
|
11
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -53,12 +53,15 @@ files:
|
|
53
53
|
- config/routes.rb
|
54
54
|
- db/migrate/20010301000000_create_unidom_contact_subscriptions.rb
|
55
55
|
- db/migrate/20010302000000_create_unidom_email_addresses.rb
|
56
|
+
- lib/rspec/models/unidom/contact/concerns/as_contact_shared_examples.rb
|
57
|
+
- lib/rspec/models/unidom/contact/concerns/as_subscriber_shared_examples.rb
|
56
58
|
- lib/rspec/models/unidom/contact/contact_subscription_spec.rb
|
57
59
|
- lib/rspec/models/unidom/contact/email_address_spec.rb
|
58
60
|
- lib/tasks/contact_tasks.rake
|
59
61
|
- lib/unidom/contact.rb
|
60
62
|
- lib/unidom/contact/engine.rb
|
61
63
|
- lib/unidom/contact/models_rspec.rb
|
64
|
+
- lib/unidom/contact/rspec_shared_examples.rb
|
62
65
|
- lib/unidom/contact/types_rspec.rb
|
63
66
|
- lib/unidom/contact/validators_rspec.rb
|
64
67
|
- lib/unidom/contact/version.rb
|