unidom-inventory 1.0.4 → 1.0.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23da6f6a88d95f3d967c591f82dee04edc301766
|
4
|
+
data.tar.gz: 17b88823afdb36beaeb8d4258b8d0e4f4b83c774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5aa6f09bc3c8a141c1af380dd91f77c876d689c025d4c36b2caf69dca1854c98182b815befcbf66eb1b17a444b5e361a23099bcf443bbc0cc964638a5249cc0
|
7
|
+
data.tar.gz: a438b20c7dc3deef6312837bcd785a10a88b51ba8d64a9641e50430feb62197a93cb2f7f8536323ce09ea264574d1144559c866f58f577ae6228e00e3dc8b649
|
data/README.md
CHANGED
@@ -138,10 +138,17 @@ require 'unidom/inventory/validators_rspec'
|
|
138
138
|
# lib/unidom.rb
|
139
139
|
Unidom::Party::Shop.class_eval do
|
140
140
|
|
141
|
+
include Unidom::Inventory::Concerns::AsStore
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
Unidom::Product::Product.class_eval do
|
146
|
+
|
141
147
|
include Unidom::Inventory::Concerns::AsStored
|
142
148
|
|
143
149
|
end
|
144
150
|
|
151
|
+
|
145
152
|
# The Unidom::Inventory::GroupedInventoryItem model & the Unidom::Inventory::SerializedInventoryItem model already include the Unidom::Inventory::Concerns::AsInventoryItem concern
|
146
153
|
# app/models/your_inventory_item.rb
|
147
154
|
class YourInventoryItem < ApplicationRecord
|
@@ -161,6 +168,13 @@ describe Unidom::Party::Shop, type: :model do
|
|
161
168
|
|
162
169
|
end
|
163
170
|
|
171
|
+
# spec/models/unidom/product/product_spec.rb
|
172
|
+
describe Unidom::Product::Product, type: :model do
|
173
|
+
|
174
|
+
it_behaves_like 'Unidom::Inventory::Concerns::AsStored', model_attributes
|
175
|
+
|
176
|
+
end
|
177
|
+
|
164
178
|
# spec/models/your_inventory_item_spec.rb
|
165
179
|
describe YourInventoryItem, type: :model do
|
166
180
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
shared_examples 'Unidom::Inventory::Concerns::AsStored' do |model_attributes|
|
2
|
+
|
3
|
+
before :each do
|
4
|
+
end
|
5
|
+
|
6
|
+
after :each do
|
7
|
+
end
|
8
|
+
|
9
|
+
context do
|
10
|
+
|
11
|
+
grouped_inventory_item_1_attributes = {
|
12
|
+
store_id: SecureRandom.uuid,
|
13
|
+
store_type: 'Unidom::Inventory::Stored::Mock',
|
14
|
+
lot_id: SecureRandom.uuid,
|
15
|
+
quantity: 10.00
|
16
|
+
}
|
17
|
+
|
18
|
+
grouped_inventory_item_2_attributes = {
|
19
|
+
store_id: SecureRandom.uuid,
|
20
|
+
store_type: 'Unidom::Inventory::Stored::Mock',
|
21
|
+
lot_id: SecureRandom.uuid,
|
22
|
+
quantity: 20.00
|
23
|
+
}
|
24
|
+
|
25
|
+
it_behaves_like 'has_many', model_attributes, :grouped_inventory_items, Unidom::Inventory::GroupedInventoryItem, [ grouped_inventory_item_1_attributes, grouped_inventory_item_2_attributes ]
|
26
|
+
|
27
|
+
serialized_inventory_item_1_attributes = {
|
28
|
+
store_id: SecureRandom.uuid,
|
29
|
+
store_type: 'Unidom::Inventory::Stored::Mock',
|
30
|
+
lot_id: SecureRandom.uuid,
|
31
|
+
serial_number: SecureRandom.hex(16)
|
32
|
+
}
|
33
|
+
|
34
|
+
serialized_inventory_item_2_attributes = {
|
35
|
+
store_id: SecureRandom.uuid,
|
36
|
+
store_type: 'Unidom::Inventory::Stored::Mock',
|
37
|
+
lot_id: SecureRandom.uuid,
|
38
|
+
serial_number: SecureRandom.hex(16)
|
39
|
+
}
|
40
|
+
|
41
|
+
it_behaves_like 'has_many', model_attributes, :serialized_inventory_items, Unidom::Inventory::SerializedInventoryItem, [ serialized_inventory_item_1_attributes, serialized_inventory_item_2_attributes ]
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.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-04-
|
11
|
+
date: 2017-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|
@@ -65,6 +65,7 @@ files:
|
|
65
65
|
- db/migrate/20020923000000_create_unidom_item_issuings.rb
|
66
66
|
- lib/rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples.rb
|
67
67
|
- lib/rspec/models/unidom/inventory/concerns/as_store_shared_examples.rb
|
68
|
+
- lib/rspec/models/unidom/inventory/concerns/as_stored_shared_examples.rb
|
68
69
|
- lib/rspec/models/unidom/inventory/grouped_inventory_item_spec.rb
|
69
70
|
- lib/rspec/models/unidom/inventory/inventory_item_variance_spec.rb
|
70
71
|
- lib/rspec/models/unidom/inventory/item_issuing_spec.rb
|