unidom-inventory 1.0.4 → 1.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d960681fe50c967cc12b23f0575dd430d5ff93d7
4
- data.tar.gz: f73af772d224d3ce113b0c4769e6af114637176b
3
+ metadata.gz: 23da6f6a88d95f3d967c591f82dee04edc301766
4
+ data.tar.gz: 17b88823afdb36beaeb8d4258b8d0e4f4b83c774
5
5
  SHA512:
6
- metadata.gz: 65046927e1af118f5014d60243a900166f9c3e23d0b9a279bf23a560f8dd4975eeaa40c24c78d002f5736b04ad42a263e0c85f6845c0cfbaab0ad5346a09dcc2
7
- data.tar.gz: 4a55193bf615571a2a0f7abd6b4036dbf985f072943d0f54e79a0507d27bbd087b92e0f00d352efde1175005f952db5213d5525ee396e71f977b1b0508db2611
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
@@ -1,2 +1,3 @@
1
1
  require 'rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples'
2
2
  require 'rspec/models/unidom/inventory/concerns/as_store_shared_examples'
3
+ require 'rspec/models/unidom/inventory/concerns/as_stored_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Inventory
3
- VERSION = '1.0.4'.freeze
3
+ VERSION = '1.0.5'.freeze
4
4
  end
5
5
  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
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 00:00:00.000000000 Z
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