unidom-inventory 0.8 → 1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/unidom/inventory/grouped_inventory_item.rb +1 -0
- data/app/models/unidom/inventory/inventory_item_variance.rb +1 -0
- data/db/migrate/20020902000000_create_unidom_grouped_inventory_items.rb +1 -1
- data/db/migrate/20020903000000_create_unidom_inventory_item_variances.rb +1 -1
- data/db/migrate/20020911000000_create_unidom_lots.rb +1 -1
- data/db/migrate/20020922000000_create_unidom_pick_items.rb +1 -1
- data/db/migrate/20020923000000_create_unidom_item_issuings.rb +1 -1
- data/lib/rspec/models/unidom/inventory/grouped_inventory_item_spec.rb +24 -0
- data/lib/rspec/models/unidom/inventory/inventory_item_variance_spec.rb +24 -0
- data/lib/rspec/models/unidom/inventory/serialized_inventory_item_spec.rb +21 -0
- data/lib/unidom/inventory/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85e68916ba502e3361af1019e4d072ad0239b5b5
|
4
|
+
data.tar.gz: ac1b5d1043e892277d1e1091168fb89612f8fe94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d19e0e8f698d7cc98b9b02880709df196e880484dd2b2c37061dc158a48e8e120bf6fbc83b029a1088f61dad520d95bbf7aff94e6336a314c744a0bb8d516e7
|
7
|
+
data.tar.gz: fe55a88b7043bd8b304231485af3df3662fdfd5376a4561b4f8a9d5176866359f9ea5ca4da9606bc05ad43eefb9bbe37bd4e8fa6010eac555209aaaa7ffd0f26
|
@@ -9,5 +9,6 @@ class Unidom::Inventory::GroupedInventoryItem < Unidom::Inventory::ApplicationRe
|
|
9
9
|
include Unidom::Inventory::Concerns::AsInventoryItem
|
10
10
|
|
11
11
|
validates :quantity, presence: true, numericality: true
|
12
|
+
#validates :quantity, presence: true, numericality: { greater_than_or_equal_to: 0.0, less_than: 1_000_000_000.00 }
|
12
13
|
|
13
14
|
end unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Inventory::GroupedInventoryItem'
|
@@ -11,6 +11,7 @@ class Unidom::Inventory::InventoryItemVariance < Unidom::Inventory::ApplicationR
|
|
11
11
|
include Unidom::Common::Concerns::ModelExtension
|
12
12
|
|
13
13
|
validates :quantity, presence: true, numericality: true
|
14
|
+
#validates :quantity, presence: true, numericality: { greater_than: -1_000_000_000.00, less_than: 1_000_000_000.00 }
|
14
15
|
|
15
16
|
belongs_to :inventory_item, polymorphic: true
|
16
17
|
belongs_to :reason, polymorphic: true
|
@@ -10,7 +10,7 @@ class CreateUnidomGroupedInventoryItems < ActiveRecord::Migration
|
|
10
10
|
polymorphic: { null: false, default: '', limit: 200 }
|
11
11
|
t.references :lot, type: :uuid, null: true
|
12
12
|
|
13
|
-
t.decimal :quantity, null: false, default: 0.0, precision:
|
13
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
|
14
14
|
|
15
15
|
t.column :state, 'char(1)', null: false, default: 'C'
|
16
16
|
t.datetime :opened_at, null: false, default: ::Time.utc(1970)
|
@@ -9,7 +9,7 @@ class CreateUnidomInventoryItemVariances < ActiveRecord::Migration
|
|
9
9
|
t.references :reason, type: :uuid, null: true,
|
10
10
|
polymorphic: { null: true, default: nil, limit: 200 }
|
11
11
|
|
12
|
-
t.decimal :quantity, null: false, default: 0.0, precision:
|
12
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
|
13
13
|
|
14
14
|
t.text :description
|
15
15
|
t.text :instruction
|
@@ -5,7 +5,7 @@ class CreateUnidomLots < ActiveRecord::Migration
|
|
5
5
|
create_table :unidom_lots, id: :uuid do |t|
|
6
6
|
|
7
7
|
t.string :identification_number, null: false, default: '', limit: 200
|
8
|
-
t.decimal :quantity, null: false, default: 0.0, precision:
|
8
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
|
9
9
|
|
10
10
|
t.text :description
|
11
11
|
t.text :instruction
|
@@ -8,7 +8,7 @@ class CreateUnidomPickItems < ActiveRecord::Migration
|
|
8
8
|
t.references :inventory_item, type: :uuid, null: false,
|
9
9
|
polymorphic: { null: false, default: '', limit: 200 }
|
10
10
|
|
11
|
-
t.decimal :quantity, null: false, default: 0.0, precision:
|
11
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
|
12
12
|
|
13
13
|
t.text :description
|
14
14
|
t.text :instruction
|
@@ -10,7 +10,7 @@ class CreateUnidomItemIssuings < ActiveRecord::Migration
|
|
10
10
|
t.references :target_item, type: :uuid, null: true,
|
11
11
|
polymorphic: { null: true, default: nil, limit: 200 }
|
12
12
|
|
13
|
-
t.decimal :quantity, null: false, default: 0.0, precision:
|
13
|
+
t.decimal :quantity, null: false, default: 0.0, precision: 12, scale: 2
|
14
14
|
|
15
15
|
t.text :description
|
16
16
|
t.text :instruction
|
@@ -19,6 +19,30 @@ describe Unidom::Inventory::GroupedInventoryItem, type: :model do
|
|
19
19
|
|
20
20
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
21
21
|
|
22
|
+
=begin
|
23
|
+
it_behaves_like 'validates', model_attributes, :quantity,
|
24
|
+
{ } => 0,
|
25
|
+
{ quantity: nil } => 2,
|
26
|
+
{ quantity: '' } => 2,
|
27
|
+
{ quantity: '1' } => 0,
|
28
|
+
{ quantity: 1 } => 0,
|
29
|
+
{ quantity: 'A' } => 1,
|
30
|
+
{ quantity: '1.23' } => 0,
|
31
|
+
{ quantity: 1.23 } => 0,
|
32
|
+
{ quantity: '-0.01' } => 1,
|
33
|
+
{ quantity: -0.01 } => 1,
|
34
|
+
{ quantity: '0' } => 0,
|
35
|
+
{ quantity: 0 } => 0,
|
36
|
+
{ quantity: '0.01' } => 0,
|
37
|
+
{ quantity: 0.01 } => 0,
|
38
|
+
{ quantity: '999_999_999.99' } => 0,
|
39
|
+
{ quantity: 999_999_999.99 } => 0,
|
40
|
+
{ quantity: '1_000_000_000' } => 1,
|
41
|
+
{ quantity: 1_000_000_000 } => 1,
|
42
|
+
{ quantity: '1_000_000_000.01' } => 1,
|
43
|
+
{ quantity: 1_000_000_000.01 } => 1
|
44
|
+
=end
|
45
|
+
|
22
46
|
end
|
23
47
|
|
24
48
|
end
|
@@ -18,6 +18,30 @@ describe Unidom::Inventory::InventoryItemVariance, type: :model do
|
|
18
18
|
|
19
19
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
20
20
|
|
21
|
+
=begin
|
22
|
+
it_behaves_like 'validates', model_attributes, :quantity,
|
23
|
+
{ } => 0,
|
24
|
+
{ quantity: nil } => 2,
|
25
|
+
{ quantity: '' } => 2,
|
26
|
+
{ quantity: '1' } => 0,
|
27
|
+
{ quantity: 1 } => 0,
|
28
|
+
{ quantity: 'A' } => 1,
|
29
|
+
{ quantity: '0.00' } => 0,
|
30
|
+
{ quantity: 0.00 } => 0,
|
31
|
+
{ quantity: '-999_999_999.99' } => 0,
|
32
|
+
{ quantity: -999_999_999.99 } => 0,
|
33
|
+
{ quantity: '-1_000_000_000' } => 1,
|
34
|
+
{ quantity: -1_000_000_000 } => 1,
|
35
|
+
{ quantity: '-1_000_000_000.01' } => 1,
|
36
|
+
{ quantity: -1_000_000_000.01 } => 1,
|
37
|
+
{ quantity: '999_999_999.99' } => 0,
|
38
|
+
{ quantity: 999_999_999.99 } => 0,
|
39
|
+
{ quantity: '1_000_000_000' } => 1,
|
40
|
+
{ quantity: 1_000_000_000 } => 1,
|
41
|
+
{ quantity: '1_000_000_000.01' } => 1,
|
42
|
+
{ quantity: 1_000_000_000.01 } => 1
|
43
|
+
=end
|
44
|
+
|
21
45
|
end
|
22
46
|
|
23
47
|
end
|
@@ -17,8 +17,29 @@ describe Unidom::Inventory::SerializedInventoryItem, type: :model do
|
|
17
17
|
serial_number: '123456789012'
|
18
18
|
}
|
19
19
|
|
20
|
+
#serial_number_max_length = described_class.columns_hash['serial_number'].limit
|
21
|
+
|
20
22
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
21
23
|
|
24
|
+
=begin
|
25
|
+
it_behaves_like 'validates', model_attributes, :serial_number,
|
26
|
+
{ } => 0,
|
27
|
+
{ serial_number: nil } => 2,
|
28
|
+
{ serial_number: '' } => 2,
|
29
|
+
{ serial_number: '1' } => 1,
|
30
|
+
{ serial_number: '11' } => 0,
|
31
|
+
{ serial_number: '111' } => 0,
|
32
|
+
{ serial_number: 'A' } => 1,
|
33
|
+
{ serial_number: 'AA' } => 0,
|
34
|
+
{ serial_number: 'AAA' } => 0,
|
35
|
+
{ serial_number: '1'*(serial_number_max_length-1) } => 0,
|
36
|
+
{ serial_number: '1'*serial_number_max_length } => 0,
|
37
|
+
{ serial_number: '1'*(serial_number_max_length+1) } => 1,
|
38
|
+
{ serial_number: 'A'*(serial_number_max_length-1) } => 0,
|
39
|
+
{ serial_number: 'A'*serial_number_max_length } => 0,
|
40
|
+
{ serial_number: 'A'*(serial_number_max_length+1) } => 1
|
41
|
+
=end
|
42
|
+
|
22
43
|
end
|
23
44
|
|
24
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: '0
|
4
|
+
version: '1.0'
|
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-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|