unidom-shipment 0.7.1 → 0.7.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7b0c73a706a0af1a8601522106f90ec7c0d84b5
|
4
|
+
data.tar.gz: c000081d698cedaf92296937814025bfeff08b07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d26229831fd5430c3089a3a709030aed50c28c67e167ecb23d8d22743fdf487d076789d1915750f09205d30051f4029295987025871e22b2e9b78d7fcc834c
|
7
|
+
data.tar.gz: 379d370767e1ebb5fc39eeb7118cb5a5763fefcb7ead6718f8f851f784fcaa19b408c3e07085ed405baa5e225600fdc1b240849619ce79e6c1cbe7075b850040
|
@@ -10,8 +10,8 @@ class Unidom::Shipment::ShipmentReceipt < Unidom::Shipment::ApplicationRecord
|
|
10
10
|
|
11
11
|
include Unidom::Common::Concerns::ModelExtension
|
12
12
|
|
13
|
-
validates :accepted_quantity, presence: true, numericality: { greater_than_or_equal_to: 0,
|
14
|
-
validates :rejected_quantity, presence: true, numericality: { greater_than_or_equal_to: 0,
|
13
|
+
validates :accepted_quantity, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
14
|
+
validates :rejected_quantity, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
15
15
|
|
16
16
|
belongs_to :package, class_name: 'Unidom::Shipment::ShipmentPackage'
|
17
17
|
belongs_to :shipped, polymorphic: true
|
@@ -22,6 +22,50 @@ describe Unidom::Shipment::ShipmentReceipt, type: :model do
|
|
22
22
|
|
23
23
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
24
24
|
|
25
|
+
it_behaves_like 'validates', model_attributes, :accepted_quantity,
|
26
|
+
{ } => 0,
|
27
|
+
{ accepted_quantity: nil } => 2,
|
28
|
+
{ accepted_quantity: '' } => 2,
|
29
|
+
{ accepted_quantity: '1' } => 0,
|
30
|
+
{ accepted_quantity: 1 } => 0,
|
31
|
+
{ accepted_quantity: 'A' } => 1,
|
32
|
+
{ accepted_quantity: '1.23' } => 0,
|
33
|
+
{ accepted_quantity: 1.23 } => 0,
|
34
|
+
{ accepted_quantity: '-0.01' } => 1,
|
35
|
+
{ accepted_quantity: -0.01 } => 1,
|
36
|
+
{ accepted_quantity: '0' } => 0,
|
37
|
+
{ accepted_quantity: 0 } => 0,
|
38
|
+
{ accepted_quantity: '0.01' } => 0,
|
39
|
+
{ accepted_quantity: 0.01 } => 0,
|
40
|
+
{ accepted_quantity: '999_999_999.99' } => 0,
|
41
|
+
{ accepted_quantity: 999_999_999.99 } => 0,
|
42
|
+
{ accepted_quantity: '1_000_000_000' } => 0,
|
43
|
+
{ accepted_quantity: 1_000_000_000 } => 0,
|
44
|
+
{ accepted_quantity: '1_000_000_000.01' } => 1,
|
45
|
+
{ accepted_quantity: 1_000_000_000.01 } => 1
|
46
|
+
|
47
|
+
it_behaves_like 'validates', model_attributes, :rejected_quantity,
|
48
|
+
{ } => 0,
|
49
|
+
{ rejected_quantity: nil } => 2,
|
50
|
+
{ rejected_quantity: '' } => 2,
|
51
|
+
{ rejected_quantity: '1' } => 0,
|
52
|
+
{ rejected_quantity: 1 } => 0,
|
53
|
+
{ rejected_quantity: 'A' } => 1,
|
54
|
+
{ rejected_quantity: '1.23' } => 0,
|
55
|
+
{ rejected_quantity: 1.23 } => 0,
|
56
|
+
{ rejected_quantity: '-0.01' } => 1,
|
57
|
+
{ rejected_quantity: -0.01 } => 1,
|
58
|
+
{ rejected_quantity: '0' } => 0,
|
59
|
+
{ rejected_quantity: 0 } => 0,
|
60
|
+
{ rejected_quantity: '0.01' } => 0,
|
61
|
+
{ rejected_quantity: 0.01 } => 0,
|
62
|
+
{ rejected_quantity: '999_999_999.99' } => 0,
|
63
|
+
{ rejected_quantity: 999_999_999.99 } => 0,
|
64
|
+
{ rejected_quantity: '1_000_000_000' } => 0,
|
65
|
+
{ rejected_quantity: 1_000_000_000 } => 0,
|
66
|
+
{ rejected_quantity: '1_000_000_000.01' } => 1,
|
67
|
+
{ rejected_quantity: 1_000_000_000.01 } => 1
|
68
|
+
|
25
69
|
end
|
26
70
|
|
27
71
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-shipment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.2
|
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-02
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|