unidom-product 1.7.4 → 1.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/rspec/models/unidom/product/concerns/as_source_product_shared_examples.rb +23 -0
- data/lib/rspec/models/unidom/product/product_spec.rb +2 -1
- data/lib/unidom/product/rspec_shared_examples.rb +1 -0
- data/lib/unidom/product/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: be31fc29fc8264f8ec170e10cefa779e194cdef2
|
4
|
+
data.tar.gz: 5d9e227e750ea6cdf79f74de4c74d34c172e3f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c147882f9338bd9d11dec4bf5a54c8e6cb85d45c2b32382becd8a3ace47e36f879c669ecd5f8c357031071349e09f52271a39cdf84d4b1e25876aa69a2edb698
|
7
|
+
data.tar.gz: 7150ae492c84d9a65934864643069a5cc403a695f679964890fbe6b73adcbbe83e56d80ce468c5451d8ca238f05e5a8cd2b5b1d8a5abf2572f455f4a8418f029
|
data/README.md
CHANGED
@@ -123,6 +123,8 @@ end
|
|
123
123
|
|
124
124
|
## RSpec examples
|
125
125
|
|
126
|
+
### RSpec example manifest (run automatically)
|
127
|
+
|
126
128
|
```ruby
|
127
129
|
# spec/models/unidom_spec.rb
|
128
130
|
require 'unidom/product/models_rspec'
|
@@ -133,3 +135,12 @@ require 'unidom/product/types_rspec'
|
|
133
135
|
# spec/validators/unidom_spec.rb
|
134
136
|
require 'unidom/product/validators_rspec'
|
135
137
|
```
|
138
|
+
|
139
|
+
### RSpec shared examples (to be integrated)
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
# The Unidom::Product::Product model already include the Unidom::Product::Concerns::AsSourceProduct concern
|
143
|
+
|
144
|
+
# spec/support/unidom_rspec_shared_examples.rb
|
145
|
+
require 'unidom/prooduct/rspec_shared_examples'
|
146
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
shared_examples 'Unidom::Product::Concerns::AsSourceProduct' do |model_attributes|
|
2
|
+
|
3
|
+
context do
|
4
|
+
|
5
|
+
target_product_associating_1_attribtues = {
|
6
|
+
target_id: SecureRandom.uuid,
|
7
|
+
product_association_code: 'CPLM',
|
8
|
+
ordinal: 1,
|
9
|
+
quantity: 1
|
10
|
+
}
|
11
|
+
|
12
|
+
target_product_associating_2_attribtues = {
|
13
|
+
target_id: SecureRandom.uuid,
|
14
|
+
product_association_code: 'ICPT',
|
15
|
+
ordinal: 2,
|
16
|
+
quantity: 2
|
17
|
+
}
|
18
|
+
|
19
|
+
it_behaves_like 'has_many', model_attributes, :target_product_associatings, Unidom::Product::ProductAssociating, [ target_product_associating_1_attribtues, target_product_associating_2_attribtues ]
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
@@ -16,7 +16,8 @@ describe Unidom::Product::Product, type: :model do
|
|
16
16
|
formset_code: 'WARE'
|
17
17
|
}
|
18
18
|
|
19
|
-
it_behaves_like 'Unidom::Common::Concerns::ModelExtension',
|
19
|
+
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
20
|
+
it_behaves_like 'Unidom::Product::Concerns::AsSourceProduct', model_attributes
|
20
21
|
|
21
22
|
it_behaves_like 'validates text', model_attributes, :name,
|
22
23
|
length: 2..described_class.columns_hash['name'].limit
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'rspec/models/unidom/product/concerns/as_source_product_shared_examples'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-product
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.5
|
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-
|
11
|
+
date: 2017-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- config/routes.rb
|
59
59
|
- db/migrate/20020201000000_create_unidom_products.rb
|
60
60
|
- db/migrate/20020211000000_create_unidom_product_associatings.rb
|
61
|
+
- lib/rspec/models/unidom/product/concerns/as_source_product_shared_examples.rb
|
61
62
|
- lib/rspec/models/unidom/product/product_associating_spec.rb
|
62
63
|
- lib/rspec/models/unidom/product/product_spec.rb
|
63
64
|
- lib/rspec/types/unidom/product/formset_spec.rb
|
@@ -66,6 +67,7 @@ files:
|
|
66
67
|
- lib/unidom/product.rb
|
67
68
|
- lib/unidom/product/engine.rb
|
68
69
|
- lib/unidom/product/models_rspec.rb
|
70
|
+
- lib/unidom/product/rspec_shared_examples.rb
|
69
71
|
- lib/unidom/product/types_rspec.rb
|
70
72
|
- lib/unidom/product/validators_rspec.rb
|
71
73
|
- lib/unidom/product/version.rb
|