unidom-accession 2.3.1 → 2.3.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 +4 -4
- data/README.md +51 -0
- data/app/models/unidom/accession/post_fulfillment.rb +2 -1
- data/lib/rspec/models/unidom/accession/concerns/as_post_fulfilled_shared_examples.rb +15 -0
- data/lib/rspec/models/unidom/accession/concerns/as_post_fulfiller_shared_examples.rb +15 -0
- data/lib/unidom/accession/rspec_shared_examples.rb +2 -0
- data/lib/unidom/accession/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: 570339b998187c75dffb782585abf1d5e701205a
|
4
|
+
data.tar.gz: c8a60afa72db9234325900288021e65fd636e7aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c16cca2d5660da1209bdd5aaf44489337ce386fdbdbff28d1891246a773d3ab855f897aace9401f56d9b456969d8d061aa92c3c40bc25bb906338ee5da3561b
|
7
|
+
data.tar.gz: 7ca9c6b401d4103cd8ba304036253946f2747af1bb2772d9abed444956d512a012d8f17442d7b0fa58002def732590ddb6cb34f29af7a5fac4b0f61ab0e29e20
|
data/README.md
CHANGED
@@ -101,6 +101,8 @@ end
|
|
101
101
|
|
102
102
|
## RSpec examples
|
103
103
|
|
104
|
+
### RSpec example manifest (run automatically)
|
105
|
+
|
104
106
|
```ruby
|
105
107
|
# spec/models/unidom_spec.rb
|
106
108
|
require 'unidom/accession/models_rspec'
|
@@ -111,3 +113,52 @@ require 'unidom/accession/types_rspec'
|
|
111
113
|
# spec/validators/unidom_spec.rb
|
112
114
|
require 'unidom/accession/validators_rspec'
|
113
115
|
```
|
116
|
+
|
117
|
+
### RSpec shared examples (to be integrated)
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
# lib/unidom.rb
|
121
|
+
def initialize_unidom
|
122
|
+
|
123
|
+
Unidom::Party::Person.class_eval do
|
124
|
+
include Unidom::Accession::Concerns::AsPostFulfiller
|
125
|
+
end
|
126
|
+
|
127
|
+
Unidom::Position::Post.class_eval do
|
128
|
+
include Unidom::Accession::Concerns::AsPostFulfilled
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
# spec/rails_helper.rb
|
134
|
+
require 'unidom'
|
135
|
+
initialize_unidom
|
136
|
+
|
137
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
138
|
+
require 'unidom/accession/rspec_shared_examples'
|
139
|
+
|
140
|
+
# spec/models/unidom/party/person_spec.rb
|
141
|
+
describe Unidom::Party::Person do
|
142
|
+
|
143
|
+
model_attribtues = {
|
144
|
+
name: 'Tim'
|
145
|
+
}
|
146
|
+
|
147
|
+
it_behaves_like 'Unidom::Accession::Concerns::AsPostFulfiller', model_attribtues
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
# spec/models/unidom/position/post_spec.rb
|
152
|
+
describe Unidom::Position::Post do
|
153
|
+
|
154
|
+
model_attribtues = {
|
155
|
+
name: 'HR Manager',
|
156
|
+
organization_id: SecureRandom.uuid,
|
157
|
+
organization_type: 'Unidom::Position::Organization::Mock',
|
158
|
+
position_id: SecureRandom.uuid
|
159
|
+
}
|
160
|
+
|
161
|
+
it_behaves_like 'Unidom::Accession::Concerns::AsPostFulfilled', model_attribtues
|
162
|
+
|
163
|
+
end
|
164
|
+
```
|
@@ -21,8 +21,9 @@ class Unidom::Accession::PostFulfillment < Unidom::Accession::ApplicationRecord
|
|
21
21
|
# Unidom::Accession::PostFulfillment.fulfill! fulfilled: post, fulfiller: selected_person
|
22
22
|
def self.fulfill!(fulfilled: nil, fulfiller: nil, opened_at: Time.now)
|
23
23
|
assert_present! :fulfilled, fulfilled
|
24
|
+
assert_present! :fulfiller, fulfiller
|
24
25
|
#raise ArgumentError.new('Argument fulfilled is required.') if fulfilled.blank?
|
25
|
-
raise ArgumentError.new('Argument fulfiller is required.') if fulfiller.blank?
|
26
|
+
#raise ArgumentError.new('Argument fulfiller is required.') if fulfiller.blank?
|
26
27
|
raise ArgumentError.new('Argument opened_at is required.') if opened_at.blank?
|
27
28
|
self.create! fulfiller: fulfiller, fulfilled: fulfilled, opened_at: opened_at
|
28
29
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
shared_examples 'Unidom::Accession::Concerns::AsPostFulfilled' do |model_attributes|
|
2
|
+
|
3
|
+
post_fulfillment_1_attribtues = {
|
4
|
+
fulfiller_id: SecureRandom.uuid,
|
5
|
+
fulfiller_type: 'Unidom::Accession::Fulfiller::Mock'
|
6
|
+
}
|
7
|
+
|
8
|
+
post_fulfillment_2_attribtues = {
|
9
|
+
fulfiller_id: SecureRandom.uuid,
|
10
|
+
fulfiller_type: 'Unidom::Accession::Fulfiller::Mock'
|
11
|
+
}
|
12
|
+
|
13
|
+
it_behaves_like 'has_many', model_attributes, :post_fulfillments, Unidom::Accession::PostFulfillment, [ post_fulfillment_1_attribtues, post_fulfillment_2_attribtues ]
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
shared_examples 'Unidom::Accession::Concerns::AsPostFulfiller' do |model_attributes|
|
2
|
+
|
3
|
+
post_fulfillment_1_attribtues = {
|
4
|
+
fulfilled_id: SecureRandom.uuid,
|
5
|
+
fulfilled_type: 'Unidom::Accession::Fulfilled::Mock'
|
6
|
+
}
|
7
|
+
|
8
|
+
post_fulfillment_2_attribtues = {
|
9
|
+
fulfilled_id: SecureRandom.uuid,
|
10
|
+
fulfilled_type: 'Unidom::Accession::Fulfilled::Mock'
|
11
|
+
}
|
12
|
+
|
13
|
+
it_behaves_like 'has_many', model_attributes, :post_fulfillments, Unidom::Accession::PostFulfillment, [ post_fulfillment_1_attribtues, post_fulfillment_2_attribtues ]
|
14
|
+
|
15
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-accession
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.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-
|
11
|
+
date: 2017-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -50,11 +50,14 @@ files:
|
|
50
50
|
- app/views/layouts/unidom/accession/application.html.erb
|
51
51
|
- config/routes.rb
|
52
52
|
- db/migrate/20040501000000_create_unidom_post_fulfillments.rb
|
53
|
+
- lib/rspec/models/unidom/accession/concerns/as_post_fulfilled_shared_examples.rb
|
54
|
+
- lib/rspec/models/unidom/accession/concerns/as_post_fulfiller_shared_examples.rb
|
53
55
|
- lib/rspec/models/unidom/accession/post_fulfillment_spec.rb
|
54
56
|
- lib/tasks/accession_tasks.rake
|
55
57
|
- lib/unidom/accession.rb
|
56
58
|
- lib/unidom/accession/engine.rb
|
57
59
|
- lib/unidom/accession/models_rspec.rb
|
60
|
+
- lib/unidom/accession/rspec_shared_examples.rb
|
58
61
|
- lib/unidom/accession/types_rspec.rb
|
59
62
|
- lib/unidom/accession/validators_rspec.rb
|
60
63
|
- lib/unidom/accession/version.rb
|