unidom-party 1.9.5 → 1.9.6

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: 3c7381e0591f0fcacb383eed6eccddab5f0ca997
4
- data.tar.gz: 0700fc8d248e08c622f41f6e1ef44cac552f9c3e
3
+ metadata.gz: 5adcbf6c4c6bf803fe800a5f6776fa2275d9a264
4
+ data.tar.gz: 8ca5c6f66278e336552b28cd5fdf95eebf2f9d72
5
5
  SHA512:
6
- metadata.gz: a7f3cb113059a2988f8c354dd5fd97e0bafeabb66351906428226bd7a025d8941781c2f87971dbd643ecf24e05ee2afa6e7a2fac64561c90132e5791d300b910
7
- data.tar.gz: e5ca0f9221cf4830d2422837a377aeb44b8f116dec8da8fe47f42c61e1b0aafcd24f2557e1292b2dbd141e12a831e823d0f13c85e8e582553a8eb699ede0b36f
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
@@ -0,0 +1,2 @@
1
+ require 'rspec/models/unidom/party/concerns/as_source_party_shared_examples'
2
+ require 'rspec/models/unidom/party/concerns/as_target_party_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Party
3
- VERSION = '1.9.5'.freeze
3
+ VERSION = '1.9.6'.freeze
4
4
  end
5
5
  end
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.5
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-03-26 00:00:00.000000000 Z
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