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 +4 -4
- data/README.md +29 -0
- data/lib/rspec/models/unidom/inventory/concerns/as_inventory_item_shared_examples.rb +14 -0
- data/lib/rspec/models/unidom/inventory/grouped_inventory_item_spec.rb +4 -0
- data/lib/rspec/models/unidom/inventory/serialized_inventory_item_spec.rb +4 -0
- data/lib/unidom/inventory/rspec_shared_examples.rb +1 -0
- data/lib/unidom/inventory/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: 32158525d1a8bf6042b9caacadf539ea2ecfd57a
|
4
|
+
data.tar.gz: 964134d12be7d9afb13dcb1746627f6858116025
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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'
|
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.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-
|
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
|