unidom-inventory 1.0.3 → 1.0.4

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: 32158525d1a8bf6042b9caacadf539ea2ecfd57a
4
- data.tar.gz: 964134d12be7d9afb13dcb1746627f6858116025
3
+ metadata.gz: d960681fe50c967cc12b23f0575dd430d5ff93d7
4
+ data.tar.gz: f73af772d224d3ce113b0c4769e6af114637176b
5
5
  SHA512:
6
- metadata.gz: fa620ba7184e6ebfa452ef1efd8f8e64eef79b3deb1243a0973f919fb33148971ef939274e8643aee1b6dcc40138025f6cdc4a9d9f97148557133b0c7ab3edb8
7
- data.tar.gz: 44e20bcb02363abc43691a79321b014d245d6d8c279f36de3dbd6e6be4f07a8aa726be350fc5138a36d6c05444799daaf9ee954539af622a4d61d174c251ed85
6
+ metadata.gz: 65046927e1af118f5014d60243a900166f9c3e23d0b9a279bf23a560f8dd4975eeaa40c24c78d002f5736b04ad42a263e0c85f6845c0cfbaab0ad5346a09dcc2
7
+ data.tar.gz: 4a55193bf615571a2a0f7abd6b4036dbf985f072943d0f54e79a0507d27bbd087b92e0f00d352efde1175005f952db5213d5525ee396e71f977b1b0508db2611
data/README.md CHANGED
@@ -135,6 +135,13 @@ require 'unidom/inventory/validators_rspec'
135
135
  ### RSpec shared examples (to be integrated)
136
136
 
137
137
  ```ruby
138
+ # lib/unidom.rb
139
+ Unidom::Party::Shop.class_eval do
140
+
141
+ include Unidom::Inventory::Concerns::AsStored
142
+
143
+ end
144
+
138
145
  # The Unidom::Inventory::GroupedInventoryItem model & the Unidom::Inventory::SerializedInventoryItem model already include the Unidom::Inventory::Concerns::AsInventoryItem concern
139
146
  # app/models/your_inventory_item.rb
140
147
  class YourInventoryItem < ApplicationRecord
@@ -147,14 +154,25 @@ end
147
154
  # spec/support/unidom_rspec_shared_examples.rb
148
155
  require 'unidom/inventory/rspec_shared_examples'
149
156
 
150
- # spec/models/unidom/party/person_spec.rb
157
+ # spec/models/unidom/party/shop_spec.rb
158
+ describe Unidom::Party::Shop, type: :model do
159
+
160
+ it_behaves_like 'Unidom::Inventory::Concerns::AsStore', model_attributes
161
+
162
+ end
163
+
164
+ # spec/models/your_inventory_item_spec.rb
151
165
  describe YourInventoryItem, type: :model do
152
166
 
153
- model_attribtues = {
154
- your_attribute: 'your value'
155
- }
167
+ context do
168
+
169
+ model_attribtues = {
170
+ your_attribute: 'your value'
171
+ }
172
+
173
+ it_behaves_like 'Unidom::Inventory::Concerns::AsInventoryItem', model_attribtues
156
174
 
157
- it_behaves_like 'Unidom::Inventory::Concerns::AsInventoryItem', model_attribtues
175
+ end
158
176
 
159
177
  end
160
178
  ```
@@ -0,0 +1,45 @@
1
+ shared_examples 'Unidom::Inventory::Concerns::AsStore' 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
+ stored_id: SecureRandom.uuid,
13
+ stored_type: 'Unidom::Inventory::Stored::Mock',
14
+ lot_id: SecureRandom.uuid,
15
+ quantity: 10.00
16
+ }
17
+
18
+ grouped_inventory_item_2_attributes = {
19
+ stored_id: SecureRandom.uuid,
20
+ stored_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
+ stored_id: SecureRandom.uuid,
29
+ stored_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
+ stored_id: SecureRandom.uuid,
36
+ stored_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 +1,2 @@
1
1
  require 'rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples'
2
+ require 'rspec/models/unidom/inventory/concerns/as_store_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Inventory
3
- VERSION = '1.0.3'.freeze
3
+ VERSION = '1.0.4'.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.3
4
+ version: 1.0.4
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-01 00:00:00.000000000 Z
11
+ date: 2017-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -64,6 +64,7 @@ files:
64
64
  - db/migrate/20020922000000_create_unidom_pick_items.rb
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
+ - lib/rspec/models/unidom/inventory/concerns/as_store_shared_examples.rb
67
68
  - lib/rspec/models/unidom/inventory/grouped_inventory_item_spec.rb
68
69
  - lib/rspec/models/unidom/inventory/inventory_item_variance_spec.rb
69
70
  - lib/rspec/models/unidom/inventory/item_issuing_spec.rb