unidom-certificate 2.1 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +113 -2
- data/app/controllers/unidom/certificate/application_controller.rb +8 -2
- data/app/helpers/unidom/certificate/application_helper.rb +7 -1
- data/app/jobs/unidom/certificate/application_job.rb +7 -1
- data/app/mailers/unidom/certificate/application_mailer.rb +9 -3
- data/app/models/unidom/certificate/application_record.rb +8 -2
- data/app/models/unidom/certificate/certificating.rb +37 -32
- data/app/models/unidom/certificate/concerns/as_certificated.rb +33 -24
- data/app/models/unidom/certificate/concerns/as_certification.rb +33 -24
- data/db/migrate/20010201000000_create_unidom_certificatings.rb +4 -4
- data/lib/rspec/models/unidom/certificate/concerns/as_certificated_shared_examples.rb +27 -0
- data/lib/rspec/models/unidom/certificate/concerns/as_certification_shared_examples.rb +39 -0
- data/lib/unidom/certificate/rspec_shared_examples.rb +2 -0
- data/lib/unidom/certificate/version.rb +1 -1
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2ace38c6993c47828a11094f9db7c0b2e1ff0f2a6fec99957557fb9a8bf1652a
|
4
|
+
data.tar.gz: 3c7cc35a01cc4ae967f516f459f1c86f355bcafb56a34fb47ecede72148f7cdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d64e1c619a1b2cea5183a7917d23f4634f7c598fa5b32b80fd736a29fa1ca258fae4a46b89bb0aa461ac0c81644ab47451c2df4248f8f90514d73ead59d14511
|
7
|
+
data.tar.gz: 71df4b7f664652f53819f0e5b6f818a0c804ca177617644a7ed23d1c9429b46c646e4e921fedef6aa53c73dfc0bf07096ff252ef5939698eb1699c058f71ba77
|
data/README.md
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
[![Gem Version](https://badge.fury.io/rb/unidom-certificate.svg)](https://badge.fury.io/rb/unidom-certificate)
|
7
7
|
[![Dependency Status](https://gemnasium.com/badges/github.com/topbitdu/unidom-certificate.svg)](https://gemnasium.com/github.com/topbitdu/unidom-certificate)
|
8
8
|
|
9
|
-
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Certificate domain model engine includes
|
10
|
-
Unidom (统一领域对象模型)
|
9
|
+
Unidom (UNIfied Domain Object Model) is a series of domain model engines. The Certificate domain model engine includes the Certificating model.
|
10
|
+
Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括认证的模型。
|
11
11
|
|
12
12
|
|
13
13
|
|
@@ -57,14 +57,18 @@ include Unidom::Certificate::Concerns::AsCertification
|
|
57
57
|
|
58
58
|
The As Certificated concern do the following tasks for the includer automatically:
|
59
59
|
1. Define the has_many :certificatings macro as: ``has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated``
|
60
|
+
|
60
61
|
2. Define the #is_certificated! method as: ``def is_certificated!(certification, by: nil, at: Time.now)``
|
62
|
+
|
61
63
|
3. Define the #is_certificated? method as: ``def is_certificated?(certification, at: Time.now)``
|
62
64
|
|
63
65
|
### As Certification concern
|
64
66
|
|
65
67
|
The As Certification concern do the following tasks for the includer automatically:
|
66
68
|
1. Define the has_many :certificatings macro as: ``has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification``
|
69
|
+
|
67
70
|
2. Define the #certificate! method as: ``def certificate!(certificated, by: nil, at: Time.now)``
|
71
|
+
|
68
72
|
3. Define the #certificate? method as: ``def certificate?(certificated, at: Time.now)``
|
69
73
|
|
70
74
|
|
@@ -87,6 +91,8 @@ end
|
|
87
91
|
|
88
92
|
## RSpec examples
|
89
93
|
|
94
|
+
### RSpec example manifest (run automatically)
|
95
|
+
|
90
96
|
```ruby
|
91
97
|
# spec/models/unidom_spec.rb
|
92
98
|
require 'unidom/certificate/models_rspec'
|
@@ -97,3 +103,108 @@ require 'unidom/certificate/types_rspec'
|
|
97
103
|
# spec/validators/unidom_spec.rb
|
98
104
|
require 'unidom/certificate/validators_rspec'
|
99
105
|
```
|
106
|
+
|
107
|
+
### RSpec shared examples (to be integrated)
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
# The Unidom::Certificate::China::BusinessLicense model, & the Unidom::Certificate::China::IdentityCard model already include the Unidom::Certificate::Concerns::AsCertification concern
|
111
|
+
|
112
|
+
# app/models/your_certification.rb
|
113
|
+
class YourCertification < ApplicationRecord
|
114
|
+
|
115
|
+
include Unidom::Common::Concerns::ModelExtension
|
116
|
+
include Unidom::Certificate::Concerns::AsCertification
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
# lib/unidom.rb
|
121
|
+
def initialize_unidom
|
122
|
+
|
123
|
+
Unidom::Party::Company.class_eval do
|
124
|
+
include Unidom::Certificate::Concerns::AsCertificated
|
125
|
+
end
|
126
|
+
|
127
|
+
Unidom::Party::Person.class_eval do
|
128
|
+
include Unidom::Certificate::Concerns::AsCertificated
|
129
|
+
end
|
130
|
+
|
131
|
+
Unidom::Party::Shop.class_eval do
|
132
|
+
include Unidom::Certificate::Concerns::AsCertificated
|
133
|
+
end
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
# spec/rails_helper.rb
|
138
|
+
require 'unidom'
|
139
|
+
initialize_unidom
|
140
|
+
|
141
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
142
|
+
require 'unidom/certificate/rspec_shared_examples'
|
143
|
+
|
144
|
+
# spec/models/unidom/party/company_spec.rb
|
145
|
+
describe Unidom::Party::Company, type: :model do
|
146
|
+
|
147
|
+
model_attribtues = {
|
148
|
+
name: 'Tesla'
|
149
|
+
}
|
150
|
+
|
151
|
+
it_behaves_like 'Unidom::Certificate::Concerns::AsCertificated', model_attribtues
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
# spec/models/unidom/party/person_spec.rb
|
156
|
+
describe Unidom::Party::Person, type: :model do
|
157
|
+
|
158
|
+
model_attribtues = {
|
159
|
+
name: 'Tim'
|
160
|
+
}
|
161
|
+
|
162
|
+
it_behaves_like 'Unidom::Certificate::Concerns::AsCertificated', model_attribtues
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
# spec/models/unidom/party/shop_spec.rb
|
167
|
+
describe Unidom::Party::Shop, type: :model do
|
168
|
+
|
169
|
+
context do
|
170
|
+
|
171
|
+
model_attribtues = {
|
172
|
+
name: 'WalMart'
|
173
|
+
}
|
174
|
+
|
175
|
+
certification_attributes = {
|
176
|
+
unified_social_credit_identifier: '510105012345678911',
|
177
|
+
name: 'Kaz',
|
178
|
+
address: 'Beijing',
|
179
|
+
legal_representative_name: 'Tim'
|
180
|
+
}
|
181
|
+
certification = Unidom::Certificate::China::BusinessLicense.unified_social_credit_identifier_is(certification_attributes.delete :unified_social_credit_identifier).first_or_create! certification_attributes
|
182
|
+
|
183
|
+
certificator_attributes = {
|
184
|
+
name: 'Tim'
|
185
|
+
}
|
186
|
+
certificator = Unidom::Party::Person.create! certificator_attributes
|
187
|
+
|
188
|
+
it_behaves_like 'Unidom::Certificate::Concerns::AsCertificated', model_attribtues, certification, certificator
|
189
|
+
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
# spec/models/your_certification_spec.rb
|
195
|
+
describe YourCertification, type: :model do
|
196
|
+
|
197
|
+
context do
|
198
|
+
|
199
|
+
model_attribtues = {
|
200
|
+
name: 'Your Certification Name',
|
201
|
+
serial_number: '12345678',
|
202
|
+
issued_on: '2020-01-01'
|
203
|
+
}
|
204
|
+
|
205
|
+
it_behaves_like 'Unidom::Certificate::Concerns::AsCertification', model_attribtues
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
end
|
210
|
+
```
|
@@ -1,6 +1,12 @@
|
|
1
1
|
##
|
2
2
|
# Application controller 是模块内所有控制器的基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Unidom
|
5
|
+
module Certificate
|
6
|
+
|
7
|
+
class ApplicationController < ActionController::Base
|
8
|
+
protect_from_forgery with: :exception
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
6
12
|
end
|
@@ -1,7 +1,13 @@
|
|
1
1
|
##
|
2
2
|
# Application mailer 是模块内所有电子邮件发送类的基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
module Unidom
|
5
|
+
module Certificate
|
6
|
+
|
7
|
+
class ApplicationMailer < ActionMailer::Base
|
8
|
+
default from: 'from@example.com'
|
9
|
+
layout 'mailer'
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
7
13
|
end
|
@@ -1,6 +1,12 @@
|
|
1
1
|
##
|
2
2
|
# Application record 是模块内所有模型的抽象基类。
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module Unidom
|
5
|
+
module Certificate
|
6
|
+
|
7
|
+
class ApplicationRecord < ActiveRecord::Base
|
8
|
+
self.abstract_class = true
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
6
12
|
end
|
@@ -1,36 +1,41 @@
|
|
1
1
|
##
|
2
2
|
# Certificating 是参与者和证书之间的认证关系。
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
scope :certification_is, ->(certification) { where certification: certification }
|
17
|
-
|
18
|
-
##
|
19
|
-
# 由认证者 certificator 用证书 certification 去认证的人或者机构 certificated ,认证时间是: opened_at。
|
20
|
-
def self.certificate!(certification: nil, certificated: nil, certificator: nil, opened_at: Time.now)
|
21
|
-
assert_present! :certification, certification
|
22
|
-
#raise ArgumentError.new('The certification argument is required.') if certification.blank?
|
23
|
-
raise ArgumentError.new('The certificated argument is required.' ) if certificated.blank?
|
24
|
-
raise ArgumentError.new('The opened_at argument is required.' ) if opened_at.blank?
|
25
|
-
|
26
|
-
attributes = { opened_at: opened_at }
|
27
|
-
if certificator.present?
|
28
|
-
attributes[:certificator] = certificator
|
29
|
-
else
|
30
|
-
attributes[:certificator_id] = Unidom::Common::NULL_UUID
|
31
|
-
attributes[:certificator_type] = ''
|
32
|
-
end
|
33
|
-
self.certification_is(certification).certificated_is(certificated).valid_at(now: opened_at).alive.first_or_create! attributes
|
34
|
-
end
|
4
|
+
module Unidom
|
5
|
+
module Certificate
|
6
|
+
|
7
|
+
class Certificating < ApplicationRecord
|
8
|
+
|
9
|
+
self.table_name = 'unidom_certificatings'
|
10
|
+
|
11
|
+
include Unidom::Common::Concerns::ModelExtension
|
12
|
+
|
13
|
+
belongs_to :certificator, polymorphic: true
|
14
|
+
belongs_to :certificated, polymorphic: true
|
15
|
+
belongs_to :certification, polymorphic: true
|
35
16
|
|
36
|
-
|
17
|
+
scope :certificated_by, ->(certificator) { where certificator: certificator }
|
18
|
+
scope :certificated_is, ->(certificated) { where certificated: certificated }
|
19
|
+
scope :certification_is, ->(certification) { where certification: certification }
|
20
|
+
|
21
|
+
##
|
22
|
+
# 由认证者 certificator 用证书 certification 去认证的人或者机构 certificated ,认证时间是: opened_at。
|
23
|
+
def self.certificate!(certification: nil, certificated: nil, certificator: nil, opened_at: Time.now)
|
24
|
+
assert_present! :certification, certification
|
25
|
+
assert_present! :certificated, certificated
|
26
|
+
assert_present! :opened_at, opened_at
|
27
|
+
|
28
|
+
attributes = { opened_at: opened_at }
|
29
|
+
if certificator.present?
|
30
|
+
attributes[:certificator] = certificator
|
31
|
+
else
|
32
|
+
attributes[:certificator_id] = Unidom::Common::NULL_UUID
|
33
|
+
attributes[:certificator_type] = ''
|
34
|
+
end
|
35
|
+
self.certification_is(certification).certificated_is(certificated).valid_at(now: opened_at).alive.first_or_create! attributes
|
36
|
+
end
|
37
|
+
|
38
|
+
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Certificate::Certificating'
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
@@ -1,42 +1,51 @@
|
|
1
1
|
##
|
2
2
|
# As Certificated 是被认证参与者的领域关注点。
|
3
3
|
|
4
|
-
module Unidom
|
4
|
+
module Unidom
|
5
|
+
module Certificate
|
6
|
+
module Concerns
|
5
7
|
|
6
|
-
|
8
|
+
module AsCertificated
|
7
9
|
|
8
|
-
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
include Unidom::Common::Concerns::ArgumentValidation
|
9
12
|
|
10
|
-
|
13
|
+
included do |includer|
|
11
14
|
|
12
|
-
|
13
|
-
# 被认证者被证书 certification 认证,认证者为 by ,认证时间是 at (缺省为当前时间)。
|
14
|
-
# 如: person.is_certificated! mcse, by: bill_gates, at: Time.now
|
15
|
-
def is_certificated!(certification, by: nil, at: Time.now)
|
15
|
+
has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certificated
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
##
|
18
|
+
# 被认证者被证书 certification 认证,认证者为 by ,认证时间是 at (缺省为当前时间)。
|
19
|
+
# 如: person.is_certificated! mcse, by: bill_gates, at: Time.now
|
20
|
+
def is_certificated!(certification, by: nil, at: Time.now)
|
20
21
|
|
21
|
-
|
22
|
+
assert_present! :certification, certification
|
23
|
+
assert_present! :by, by
|
24
|
+
assert_present! :at, at
|
22
25
|
|
23
|
-
|
26
|
+
certificatings.certification_is(certification).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
|
24
27
|
|
25
|
-
|
26
|
-
# 判断当前被认证者在指定的时间 at (缺省为当前时间)是否有指定的证书 certification 。如:
|
27
|
-
# person.is_certificated? mcse, at: Time.now
|
28
|
-
def is_certificated?(certification, at: Time.now)
|
28
|
+
end
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
##
|
31
|
+
# 判断当前被认证者在指定的时间 at (缺省为当前时间)是否有指定的证书 certification 。如:
|
32
|
+
# person.is_certificated? mcse, at: Time.now
|
33
|
+
def is_certificated?(certification, at: Time.now)
|
32
34
|
|
33
|
-
|
35
|
+
assert_present! :certification, certification
|
36
|
+
assert_present! :at, at
|
34
37
|
|
35
|
-
|
38
|
+
certificatings.certification_is(certification).valid_at(now: at).alive.exists?
|
36
39
|
|
37
|
-
|
40
|
+
end
|
38
41
|
|
39
|
-
|
40
|
-
end
|
42
|
+
end
|
41
43
|
|
44
|
+
module ClassMethods
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
42
51
|
end
|
@@ -1,42 +1,51 @@
|
|
1
1
|
##
|
2
2
|
# As Certification 是证书的领域关注点。
|
3
3
|
|
4
|
-
module Unidom
|
4
|
+
module Unidom
|
5
|
+
module Certificate
|
6
|
+
module Concerns
|
5
7
|
|
6
|
-
|
8
|
+
module AsCertification
|
7
9
|
|
8
|
-
|
10
|
+
extend ActiveSupport::Concern
|
11
|
+
include Unidom::Common::Concerns::ArgumentValidation
|
9
12
|
|
10
|
-
|
13
|
+
included do |includer|
|
11
14
|
|
12
|
-
|
13
|
-
# 用证书去认证参与者(被认证者)。 by 是认证者, at 是认证时间(缺省为当前时间)。
|
14
|
-
# 如:mcse.certificate! person, by: bill_gates, at: Time.now
|
15
|
-
def certificate!(certificated, by: nil, at: Time.now)
|
15
|
+
has_many :certificatings, class_name: 'Unidom::Certificate::Certificating', as: :certification
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
##
|
18
|
+
# 用证书去认证参与者(被认证者)。 by 是认证者, at 是认证时间(缺省为当前时间)。
|
19
|
+
# 如:mcse.certificate! person, by: bill_gates, at: Time.now
|
20
|
+
def certificate!(certificated, by: nil, at: Time.now)
|
20
21
|
|
21
|
-
|
22
|
+
assert_present! :certificated, certificated
|
23
|
+
assert_present! :by, by
|
24
|
+
assert_present! :at, at
|
22
25
|
|
23
|
-
|
26
|
+
certificatings.certificated_is(certificated).valid_at(now: at).alive.first_or_create! certificator: by, opened_at: at
|
24
27
|
|
25
|
-
|
26
|
-
# 判断当前认证书在指定的时间 at (缺省为当前时间)是否对被认证者 certificated 生效。如:
|
27
|
-
# mcse.certificated? person, at: Time.now
|
28
|
-
def certificate?(certificated, at: Time.now)
|
28
|
+
end
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
##
|
31
|
+
# 判断当前认证书在指定的时间 at (缺省为当前时间)是否对被认证者 certificated 生效。如:
|
32
|
+
# mcse.certificated? person, at: Time.now
|
33
|
+
def certificate?(certificated, at: Time.now)
|
32
34
|
|
33
|
-
|
35
|
+
assert_present! :certificated, certificated
|
36
|
+
assert_present! :at, at
|
34
37
|
|
35
|
-
|
38
|
+
certificatings.certificated_is(certificated).valid_at(now: at).alive.exists?
|
36
39
|
|
37
|
-
|
40
|
+
end
|
38
41
|
|
39
|
-
|
40
|
-
end
|
42
|
+
end
|
41
43
|
|
44
|
+
module ClassMethods
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
42
51
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateUnidomCertificatings < ActiveRecord::Migration
|
1
|
+
class CreateUnidomCertificatings < ActiveRecord::Migration[6.0]
|
2
2
|
|
3
3
|
def change
|
4
4
|
|
@@ -11,9 +11,9 @@ class CreateUnidomCertificatings < ActiveRecord::Migration
|
|
11
11
|
t.references :certification, type: :uuid, null: false,
|
12
12
|
polymorphic: { null: false, default: '', limit: 200 }
|
13
13
|
|
14
|
-
t.column :state, 'char(1)', null: false, default:
|
15
|
-
t.datetime :opened_at, null: false, default: ::
|
16
|
-
t.datetime :closed_at, null: false, default: ::
|
14
|
+
t.column :state, 'char(1)', null: false, default: Unidom::Common::STATE
|
15
|
+
t.datetime :opened_at, null: false, default: Unidom::Common::OPENED_AT
|
16
|
+
t.datetime :closed_at, null: false, default: Unidom::Common::CLOSED_AT
|
17
17
|
t.boolean :defunct, null: false, default: false
|
18
18
|
t.jsonb :notation, null: false, default: {}
|
19
19
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
shared_examples 'Unidom::Certificate::Concerns::AsCertificated' do |model_attributes, certification, certificator|
|
2
|
+
|
3
|
+
context do
|
4
|
+
|
5
|
+
certificating_1_attribtues = {
|
6
|
+
certificator_id: SecureRandom.uuid,
|
7
|
+
certificator_type: 'Unidom::Certificate::Certificator::Mock',
|
8
|
+
certification_id: SecureRandom.uuid,
|
9
|
+
certification_type: 'Unidom::Certificate::Certification::Mock'
|
10
|
+
}
|
11
|
+
|
12
|
+
certificating_2_attribtues = {
|
13
|
+
certificator_id: SecureRandom.uuid,
|
14
|
+
certificator_type: 'Unidom::Certificate::Certificator::Mock',
|
15
|
+
certification_id: SecureRandom.uuid,
|
16
|
+
certification_type: 'Unidom::Certificate::Certification::Mock'
|
17
|
+
}
|
18
|
+
|
19
|
+
it_behaves_like 'has_many', model_attributes, :certificatings, Unidom::Certificate::Certificating, [ certificating_1_attribtues, certificating_2_attribtues ]
|
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
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
shared_examples 'Unidom::Certificate::Concerns::AsCertification' do |model_attributes, model, certificated, certificator|
|
2
|
+
|
3
|
+
#subject do described_class.create! model_attributes end
|
4
|
+
#it '#certificate!' do
|
5
|
+
it_behaves_like 'assert_present!', model, :certificate!, [ certificated, { by: certificator, at: Time.now } ], [ { 0 => :certificated }, :by, :at ]
|
6
|
+
#end
|
7
|
+
#it '#certificate?' do
|
8
|
+
it_behaves_like 'assert_present!', model, :certificate?, [ certificated, { at: Time.now } ], [ { 0 => :certificated }, :at ]
|
9
|
+
#end
|
10
|
+
|
11
|
+
context do
|
12
|
+
|
13
|
+
certificating_1_attribtues = {
|
14
|
+
certificator_id: SecureRandom.uuid,
|
15
|
+
certificator_type: 'Unidom::Certificate::Certificator::Mock',
|
16
|
+
certificated_id: SecureRandom.uuid,
|
17
|
+
certificated_type: 'Unidom::Certificate::Certificated::Mock'
|
18
|
+
}
|
19
|
+
|
20
|
+
certificating_2_attribtues = {
|
21
|
+
certificator_id: SecureRandom.uuid,
|
22
|
+
certificator_type: 'Unidom::Certificate::Certificator::Mock',
|
23
|
+
certificated_id: SecureRandom.uuid,
|
24
|
+
certificated_type: 'Unidom::Certificate::Certificated::Mock'
|
25
|
+
}
|
26
|
+
|
27
|
+
it_behaves_like 'has_many', model_attributes, :certificatings, Unidom::Certificate::Certificating, [ certificating_1_attribtues, certificating_2_attribtues ]
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
context do
|
32
|
+
|
33
|
+
#model = described_class.create! model_attributes
|
34
|
+
#it_behaves_like 'assert_present!', model, :certificate!, [ certificated, { by: certificator, at: Time.now } ], [ { 0 => :certificated }, :by, :at ]
|
35
|
+
#it_behaves_like 'assert_present!', model, :certificate?, [ certificated, { at: Time.now } ], [ { 0 => :certificated }, :at ]
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
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:
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -16,17 +16,16 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
description: Unidom (UNIfied Domain Object Model) is a series of domain model engines.
|
28
|
-
The Certificate domain model engine includes
|
29
|
-
models. Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括身份证和营业执照的模型。
|
28
|
+
The Certificate domain model engine includes Certificating model. Unidom (统一领域对象模型)是一系列的领域模型引擎。证书领域模型引擎包括认证的模型。
|
30
29
|
email:
|
31
30
|
- topbit.du@gmail.com
|
32
31
|
executables: []
|
@@ -51,18 +50,21 @@ files:
|
|
51
50
|
- config/routes.rb
|
52
51
|
- db/migrate/20010201000000_create_unidom_certificatings.rb
|
53
52
|
- lib/rspec/models/unidom/certificate/certificating_spec.rb
|
53
|
+
- lib/rspec/models/unidom/certificate/concerns/as_certificated_shared_examples.rb
|
54
|
+
- lib/rspec/models/unidom/certificate/concerns/as_certification_shared_examples.rb
|
54
55
|
- lib/tasks/certificate_tasks.rake
|
55
56
|
- lib/unidom/certificate.rb
|
56
57
|
- lib/unidom/certificate/engine.rb
|
57
58
|
- lib/unidom/certificate/models_rspec.rb
|
59
|
+
- lib/unidom/certificate/rspec_shared_examples.rb
|
58
60
|
- lib/unidom/certificate/types_rspec.rb
|
59
61
|
- lib/unidom/certificate/validators_rspec.rb
|
60
62
|
- lib/unidom/certificate/version.rb
|
61
|
-
homepage: https://
|
63
|
+
homepage: https://gitee.com/Unidom/unidom-certificate
|
62
64
|
licenses:
|
63
65
|
- MIT
|
64
66
|
metadata: {}
|
65
|
-
post_install_message:
|
67
|
+
post_install_message:
|
66
68
|
rdoc_options: []
|
67
69
|
require_paths:
|
68
70
|
- lib
|
@@ -77,9 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
79
|
- !ruby/object:Gem::Version
|
78
80
|
version: '0'
|
79
81
|
requirements: []
|
80
|
-
|
81
|
-
|
82
|
-
signing_key:
|
82
|
+
rubygems_version: 3.2.3
|
83
|
+
signing_key:
|
83
84
|
specification_version: 4
|
84
85
|
summary: Unidom Certificate Domain Model Engine 证书领域模型引擎
|
85
86
|
test_files: []
|