unidom-certificate 2.1.1 → 2.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd70eeabf4ae48d02909c4530a68f2fccb3d63bd
4
- data.tar.gz: 12af2197e143c187cfa930b44fa38d7ffe5c9bff
3
+ metadata.gz: 6a73ff7033e661adc95265a518af8bd9403cbb0f
4
+ data.tar.gz: 46aaf1c79c590b9b58023041773086f94e7d0b1c
5
5
  SHA512:
6
- metadata.gz: 94dd5fb13696c9572e269120a2e3c5000dc0babaf7f70d828ad2321c48702bc5a4428f9fb6cc11519e5477622eeff23683b7f25a085c45709779270d7b10daa0
7
- data.tar.gz: 4b1dd04d8e254be707db42d6c29d3d0884e5d4d324fbaa4fba78cf5af38596f62b125a924a3150e5039054a988a6f3a5d873d9d7fe5024b1f41e5f3a6f20ca70
6
+ metadata.gz: 724fc9aae9f6d1d1057d9e277ff570a067db98cd622bfc14801746fa9db5b4b8ad05cc565131e261ef87e9349badb23789fe249d0a8a79ba45c7ec12d48bc655
7
+ data.tar.gz: 8b4d343cf611d1a3e63ef66246ac0fdf8c6c87ab812607785d5b8c5e841c4b294f5bf641b83ec03b345c44d5fd088e7c884460d4f6f4cf7ecc5acf2b68eb3ef2
data/README.md CHANGED
@@ -162,24 +162,45 @@ end
162
162
  # spec/models/unidom/party/shop_spec.rb
163
163
  describe Unidom::Party::Shop, type: :model do
164
164
 
165
- model_attribtues = {
166
- name: 'WalMart'
167
- }
165
+ context do
168
166
 
169
- it_behaves_like 'Unidom::Certificate::Concerns::AsCertificated', model_attribtues
167
+ model_attribtues = {
168
+ name: 'WalMart'
169
+ }
170
+
171
+ certification_attributes = {
172
+ unified_social_credit_identifier: '510105012345678911',
173
+ name: 'Kaz',
174
+ address: 'Beijing',
175
+ legal_representative_name: 'Tim'
176
+ }
177
+ certification = Unidom::Certificate::China::BusinessLicense.unified_social_credit_identifier_is(certification_attributes.delete :unified_social_credit_identifier).first_or_create! certification_attributes
178
+
179
+ certificator_attributes = {
180
+ name: 'Tim'
181
+ }
182
+ certificator = Unidom::Party::Person.create! certificator_attributes
183
+
184
+ it_behaves_like 'Unidom::Certificate::Concerns::AsCertificated', model_attribtues, certification, certificator
185
+
186
+ end
170
187
 
171
188
  end
172
189
 
173
190
  # spec/models/your_certification_spec.rb
174
191
  describe YourCertification, type: :model do
175
192
 
176
- model_attribtues = {
177
- name: 'Your Certification Name',
178
- serial_number: '12345678',
179
- issued_on: '2020-01-01'
180
- }
193
+ context do
181
194
 
182
- it_behaves_like 'Unidom::Certificate::Concerns::AsCertification', model_attribtues
195
+ model_attribtues = {
196
+ name: 'Your Certification Name',
197
+ serial_number: '12345678',
198
+ issued_on: '2020-01-01'
199
+ }
200
+
201
+ it_behaves_like 'Unidom::Certificate::Concerns::AsCertification', model_attribtues
202
+
203
+ end
183
204
 
184
205
  end
185
206
  ```
@@ -1,4 +1,4 @@
1
- shared_examples 'Unidom::Certificate::Concerns::AsCertificated' do |model_attributes|
1
+ shared_examples 'Unidom::Certificate::Concerns::AsCertificated' do |model_attributes, certification, certificator|
2
2
 
3
3
  context do
4
4
 
@@ -18,6 +18,10 @@ shared_examples 'Unidom::Certificate::Concerns::AsCertificated' do |model_attrib
18
18
 
19
19
  it_behaves_like 'has_many', model_attributes, :certificatings, Unidom::Certificate::Certificating, [ certificating_1_attribtues, certificating_2_attribtues ]
20
20
 
21
+ model = described_class.create! model_attributes
22
+ it_behaves_like 'assert_present!', model, :is_certificated!, [ certification, { by: certificator, at: Time.now } ], [ { 0 => :certification }, :by, :at ]
23
+ it_behaves_like 'assert_present!', model, :is_certificated?, [ certification, { at: Time.now } ], [ { 0 => :certification }, :at ]
24
+
21
25
  end
22
26
 
23
27
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Certificate
3
- VERSION = '2.1.1'.freeze
3
+ VERSION = '2.1.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-certificate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.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-03-25 00:00:00.000000000 Z
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common