unidom-contact 1.4.3 → 1.4.4

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: 1279e8fb49679bb9cda38f9588c0936587eb9c89
4
- data.tar.gz: f3d0d9303dda8d4de038532971e1677e5966c60c
3
+ metadata.gz: '08e9ef952f53a815323984ef8c5b678e0b50ff61'
4
+ data.tar.gz: 269b15a2fd123f0c732456883f595032dcd1a4ae
5
5
  SHA512:
6
- metadata.gz: 290bcfa82b871a4220f30f347c14ff6fd4765116f7c8ec45027b9bc519b5b09fa939c4ec36c1bf53d10405dfc60067d6e197dfb4773dcfc44f673b2cc2d79126
7
- data.tar.gz: e0ec351ffa15ab6c36db6f6d3613fa47f864c6a8331eae329958a046dd595becda1074dd46e0ac85c4c9fa5c64788ee6568d40c7a338189ece2340f1bf31c249
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
 
@@ -0,0 +1,2 @@
1
+ require 'rspec/models/unidom/contact/concerns/as_contact_shared_examples'
2
+ require 'rspec/models/unidom/contact/concerns/as_subscriber_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Contact
3
- VERSION = '1.4.3'.freeze
3
+ VERSION = '1.4.4'.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.3
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-14 00:00:00.000000000 Z
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