unidom-party 1.9.5 → 1.9.6
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 +32 -0
- data/lib/rspec/models/unidom/party/company_spec.rb +4 -0
- data/lib/rspec/models/unidom/party/concerns/as_target_party_shared_examples.rb +15 -0
- data/lib/rspec/models/unidom/party/government_agency_spec.rb +4 -0
- data/lib/rspec/models/unidom/party/person_spec.rb +5 -2
- data/lib/rspec/models/unidom/party/shop_spec.rb +4 -0
- data/lib/unidom/party/rspec_shared_examples.rb +2 -0
- data/lib/unidom/party/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5adcbf6c4c6bf803fe800a5f6776fa2275d9a264
|
4
|
+
data.tar.gz: 8ca5c6f66278e336552b28cd5fdf95eebf2f9d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb215df4a4644b6cd8dc2fef0432119b1bfba8bf2697ab85015758736e803de32f2334aa5135497a37e15a4db5656dd4addd8df6ff0710cd8ad6f68622cc064c
|
7
|
+
data.tar.gz: 6092b6bd9b2d092f6610ff59f1b2b262bfd1615748b936bc3e3c36b83c2c39242bd2740e461cdc99f3559f90225562594073f407aee40f214ccce4b0847b4741
|
data/README.md
CHANGED
@@ -135,6 +135,8 @@ end
|
|
135
135
|
|
136
136
|
## RSpec examples
|
137
137
|
|
138
|
+
### RSpec example manifest (run automatically)
|
139
|
+
|
138
140
|
```ruby
|
139
141
|
# spec/models/unidom_spec.rb
|
140
142
|
require 'unidom/party/models_rspec'
|
@@ -145,3 +147,33 @@ require 'unidom/party/types_rspec'
|
|
145
147
|
# spec/validators/unidom_spec.rb
|
146
148
|
require 'unidom/party/validators_rspec'
|
147
149
|
```
|
150
|
+
|
151
|
+
### RSpec shared examples (to be integrated)
|
152
|
+
|
153
|
+
```ruby
|
154
|
+
# The Unidom::Party::Company model, the Unidom::Party::GovernmentAgency model, the Unidom::Party::Person model, & the Unidom::Party::Shop model already include the Unidom::Party::Concerns::AsSourceParty concern, & the Unidom::Party::Concerns::AsTargetParty concern
|
155
|
+
|
156
|
+
# app/models/your_party.rb
|
157
|
+
class YourParty < ActiveRecord::Base
|
158
|
+
|
159
|
+
include Unidom::Common::Concerns::ModelExtension
|
160
|
+
include Unidom::Party::Concerns::AsSourceParty
|
161
|
+
include Unidom::Party::Concerns::AsTargetParty
|
162
|
+
|
163
|
+
end
|
164
|
+
|
165
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
166
|
+
require 'unidom/party/rspec_shared_examples'
|
167
|
+
|
168
|
+
# spec/models/your_party_spec.rb
|
169
|
+
describe YourParty, type: :model do
|
170
|
+
|
171
|
+
model_attribtues = {
|
172
|
+
your_attribtue: 'your value'
|
173
|
+
}
|
174
|
+
|
175
|
+
it_behaves_like 'Unidom::Party::Concerns::AsSourceParty', model_attribtues
|
176
|
+
it_behaves_like 'Unidom::Party::Concerns::AsTargetParty', model_attribtues
|
177
|
+
|
178
|
+
end
|
179
|
+
```
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'rspec/models/unidom/party/concerns/as_source_party_shared_examples'
|
2
|
+
require 'rspec/models/unidom/party/concerns/as_target_party_shared_examples'
|
3
|
+
|
1
4
|
describe Unidom::Party::Company, type: :model do
|
2
5
|
|
3
6
|
before :each do
|
@@ -14,6 +17,7 @@ describe Unidom::Party::Company, type: :model do
|
|
14
17
|
|
15
18
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
19
|
it_behaves_like 'Unidom::Party::Concerns::AsSourceParty', model_attributes
|
20
|
+
it_behaves_like 'Unidom::Party::Concerns::AsTargetParty', model_attributes
|
17
21
|
|
18
22
|
it_behaves_like 'validates text', model_attributes, :name, length: 2..described_class.columns_hash['name'].limit
|
19
23
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
shared_examples 'Unidom::Party::Concerns::AsTargetParty' do |model_attributes|
|
2
|
+
|
3
|
+
context do
|
4
|
+
|
5
|
+
source_person_1 = Unidom::Party::Person.create! name: 'Tim'
|
6
|
+
source_person_2 = Unidom::Party::Person.create! name: 'Tom'
|
7
|
+
|
8
|
+
source_party_relation_1_attributes = { source_party: source_person_1 }
|
9
|
+
source_party_relation_2_attributes = { source_party: source_person_2 }
|
10
|
+
|
11
|
+
it_behaves_like 'has_many', model_attributes, :source_party_relations, Unidom::Party::PartyRelation, [ source_party_relation_1_attributes, source_party_relation_2_attributes ]
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'rspec/models/unidom/party/concerns/as_source_party_shared_examples'
|
2
|
+
require 'rspec/models/unidom/party/concerns/as_target_party_shared_examples'
|
3
|
+
|
1
4
|
describe Unidom::Party::GovernmentAgency, type: :model do
|
2
5
|
|
3
6
|
before :each do
|
@@ -17,6 +20,7 @@ describe Unidom::Party::GovernmentAgency, type: :model do
|
|
17
20
|
|
18
21
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
19
22
|
it_behaves_like 'Unidom::Party::Concerns::AsSourceParty', model_attributes
|
23
|
+
it_behaves_like 'Unidom::Party::Concerns::AsTargetParty', model_attributes
|
20
24
|
|
21
25
|
it_behaves_like 'validates text', model_attributes, :name, length: 2..described_class.columns_hash['name'].limit
|
22
26
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'rspec/models/unidom/party/concerns/as_source_party_shared_examples'
|
2
|
+
require 'rspec/models/unidom/party/concerns/as_target_party_shared_examples'
|
3
|
+
|
1
4
|
describe Unidom::Party::Person, type: :model do
|
2
5
|
|
3
6
|
before :each do
|
@@ -14,9 +17,9 @@ describe Unidom::Party::Person, type: :model do
|
|
14
17
|
|
15
18
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
19
|
it_behaves_like 'Unidom::Party::Concerns::AsSourceParty', model_attributes
|
20
|
+
it_behaves_like 'Unidom::Party::Concerns::AsTargetParty', model_attributes
|
17
21
|
|
18
|
-
it_behaves_like 'validates text', model_attributes, :name,
|
19
|
-
length: 2..described_class.columns_hash['name'].limit
|
22
|
+
it_behaves_like 'validates text', model_attributes, :name, length: 2..described_class.columns_hash['name'].limit
|
20
23
|
|
21
24
|
end
|
22
25
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'rspec/models/unidom/party/concerns/as_source_party_shared_examples'
|
2
|
+
require 'rspec/models/unidom/party/concerns/as_target_party_shared_examples'
|
3
|
+
|
1
4
|
describe Unidom::Party::Shop, type: :model do
|
2
5
|
|
3
6
|
before :each do
|
@@ -14,6 +17,7 @@ describe Unidom::Party::Shop, type: :model do
|
|
14
17
|
|
15
18
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
16
19
|
it_behaves_like 'Unidom::Party::Concerns::AsSourceParty', model_attributes
|
20
|
+
it_behaves_like 'Unidom::Party::Concerns::AsTargetParty', model_attributes
|
17
21
|
|
18
22
|
it_behaves_like 'validates text', model_attributes, :name,
|
19
23
|
length: 2..described_class.columns_hash['name'].limit
|
data/lib/unidom/party/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-party
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.6
|
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-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -68,6 +68,7 @@ files:
|
|
68
68
|
- lib/rspec/models/unidom/party/collaborating_spec.rb
|
69
69
|
- lib/rspec/models/unidom/party/company_spec.rb
|
70
70
|
- lib/rspec/models/unidom/party/concerns/as_source_party_shared_examples.rb
|
71
|
+
- lib/rspec/models/unidom/party/concerns/as_target_party_shared_examples.rb
|
71
72
|
- lib/rspec/models/unidom/party/government_agency_spec.rb
|
72
73
|
- lib/rspec/models/unidom/party/party_relation_spec.rb
|
73
74
|
- lib/rspec/models/unidom/party/person_spec.rb
|
@@ -77,6 +78,7 @@ files:
|
|
77
78
|
- lib/unidom/party.rb
|
78
79
|
- lib/unidom/party/engine.rb
|
79
80
|
- lib/unidom/party/models_rspec.rb
|
81
|
+
- lib/unidom/party/rspec_shared_examples.rb
|
80
82
|
- lib/unidom/party/types_rspec.rb
|
81
83
|
- lib/unidom/party/validators_rspec.rb
|
82
84
|
- lib/unidom/party/version.rb
|