unidom-inventory 1.0.2 → 1.0.3

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: e7d10e6c316c3238d67e6be51e20f47f89adadfc
4
- data.tar.gz: c6966f7274504bc4564f13ac89edcc7aca5f98f6
3
+ metadata.gz: 32158525d1a8bf6042b9caacadf539ea2ecfd57a
4
+ data.tar.gz: 964134d12be7d9afb13dcb1746627f6858116025
5
5
  SHA512:
6
- metadata.gz: 9dcc0199d34c53fdbb07e98eefb3efa9017d9c6d5bc6246f05d0c0597780990180859996a8c6d05f234c4e5fa81dc00dc3fa59619505b37140667b14a47ae23d
7
- data.tar.gz: 0353dd0e2b2b354b5217483ace80f90a0015bab8efb2ddc7cd1db5453a09d9c7bfcd297358f3802d177cf92fa16b0f7e0c0d9b1bf75d42031214a3418be85cfe
6
+ metadata.gz: fa620ba7184e6ebfa452ef1efd8f8e64eef79b3deb1243a0973f919fb33148971ef939274e8643aee1b6dcc40138025f6cdc4a9d9f97148557133b0c7ab3edb8
7
+ data.tar.gz: 44e20bcb02363abc43691a79321b014d245d6d8c279f36de3dbd6e6be4f07a8aa726be350fc5138a36d6c05444799daaf9ee954539af622a4d61d174c251ed85
data/README.md CHANGED
@@ -119,6 +119,8 @@ end
119
119
 
120
120
  ## RSpec examples
121
121
 
122
+ ### RSpec example manifest (run automatically)
123
+
122
124
  ```ruby
123
125
  # spec/models/unidom_spec.rb
124
126
  require 'unidom/inventory/models_rspec'
@@ -129,3 +131,30 @@ require 'unidom/inventory/types_rspec'
129
131
  # spec/validators/unidom_spec.rb
130
132
  require 'unidom/inventory/validators_rspec'
131
133
  ```
134
+
135
+ ### RSpec shared examples (to be integrated)
136
+
137
+ ```ruby
138
+ # The Unidom::Inventory::GroupedInventoryItem model & the Unidom::Inventory::SerializedInventoryItem model already include the Unidom::Inventory::Concerns::AsInventoryItem concern
139
+ # app/models/your_inventory_item.rb
140
+ class YourInventoryItem < ApplicationRecord
141
+
142
+ include Unidom::Common::Concerns::ModelExtension
143
+ include Unidom::Inventory::Concerns::AsInventoryItem
144
+
145
+ end
146
+
147
+ # spec/support/unidom_rspec_shared_examples.rb
148
+ require 'unidom/inventory/rspec_shared_examples'
149
+
150
+ # spec/models/unidom/party/person_spec.rb
151
+ describe YourInventoryItem, type: :model do
152
+
153
+ model_attribtues = {
154
+ your_attribute: 'your value'
155
+ }
156
+
157
+ it_behaves_like 'Unidom::Inventory::Concerns::AsInventoryItem', model_attribtues
158
+
159
+ end
160
+ ```
@@ -0,0 +1,14 @@
1
+ shared_examples 'Unidom::Inventory::Concerns::AsInventoryItem' do |model_attributes|
2
+
3
+ context do
4
+
5
+ lot_attributes = {
6
+ identification_number: '123456789012',
7
+ quantity: 120.000000
8
+ }
9
+
10
+ it_behaves_like 'belongs_to', model_attributes, :lot, Unidom::Inventory::Lot, lot_attributes
11
+
12
+ end
13
+
14
+ end
@@ -1,3 +1,5 @@
1
+ require 'rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples'
2
+
1
3
  describe Unidom::Inventory::GroupedInventoryItem, type: :model do
2
4
 
3
5
  before :each do
@@ -22,6 +24,8 @@ describe Unidom::Inventory::GroupedInventoryItem, type: :model do
22
24
  it_behaves_like 'validates numericality', model_attributes, :quantity,
23
25
  range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true
24
26
 
27
+ it_behaves_like 'Unidom::Inventory::Concerns::AsInventoryItem', model_attributes
28
+
25
29
  end
26
30
 
27
31
  end
@@ -1,3 +1,5 @@
1
+ require 'rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples'
2
+
1
3
  describe Unidom::Inventory::SerializedInventoryItem, type: :model do
2
4
 
3
5
  before :each do
@@ -22,6 +24,8 @@ describe Unidom::Inventory::SerializedInventoryItem, type: :model do
22
24
  it_behaves_like 'validates text', model_attributes, :serial_number,
23
25
  length: 2..described_class.columns_hash['serial_number'].limit
24
26
 
27
+ it_behaves_like 'Unidom::Inventory::Concerns::AsInventoryItem', model_attributes
28
+
25
29
  end
26
30
 
27
31
  end
@@ -0,0 +1 @@
1
+ require 'rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples'
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Inventory
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.0.3'.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.2
4
+ version: 1.0.3
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-22 00:00:00.000000000 Z
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -63,6 +63,7 @@ files:
63
63
  - db/migrate/20020921000000_create_unidom_pick_lists.rb
64
64
  - db/migrate/20020922000000_create_unidom_pick_items.rb
65
65
  - db/migrate/20020923000000_create_unidom_item_issuings.rb
66
+ - lib/rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples.rb
66
67
  - lib/rspec/models/unidom/inventory/grouped_inventory_item_spec.rb
67
68
  - lib/rspec/models/unidom/inventory/inventory_item_variance_spec.rb
68
69
  - lib/rspec/models/unidom/inventory/item_issuing_spec.rb
@@ -74,6 +75,7 @@ files:
74
75
  - lib/unidom/inventory.rb
75
76
  - lib/unidom/inventory/engine.rb
76
77
  - lib/unidom/inventory/models_rspec.rb
78
+ - lib/unidom/inventory/rspec_shared_examples.rb
77
79
  - lib/unidom/inventory/types_rspec.rb
78
80
  - lib/unidom/inventory/validators_rspec.rb
79
81
  - lib/unidom/inventory/version.rb