unidom-shipment 0.7.4 → 0.7.5
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/shipment/shipment.rb +2 -2
- data/app/models/unidom/shipment/shipment_item.rb +1 -1
- data/lib/rspec/models/unidom/shipment/shipment_item_spec.rb +2 -21
- data/lib/rspec/models/unidom/shipment/shipment_spec.rb +4 -43
- data/lib/unidom/shipment/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: f3b1d844aba04169392e5aac790c6a4eec54ac6d
|
4
|
+
data.tar.gz: 79a94874b8aa88dac980d1ac366f39630e95a14d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 634b0175640734d0ef6915636a5c87ba09afc0364c36575583ad181312512f3880478057c908fdc463f9b2d37f26f949d505d08efab3b8417cebcaa4be8614a8
|
7
|
+
data.tar.gz: 291052b56410ee93a34630a330a065938833da692b8e5e13bbc335b7097cdbd59b5ae1ae46eb31ec4e92e46456f9b348fedd7742cf0363edaa478cf1f56d1389
|
@@ -8,8 +8,8 @@ class Unidom::Shipment::Shipment < Unidom::Shipment::ApplicationRecord
|
|
8
8
|
include Unidom::Common::Concerns::ModelExtension
|
9
9
|
include ProgneTapera::EnumCode
|
10
10
|
|
11
|
-
validates :estimated_amount, presence: true, numericality: { greater_than_or_equal_to: 0,
|
12
|
-
validates :actual_amount, presence: true, numericality: { greater_than_or_equal_to: 0,
|
11
|
+
validates :estimated_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
12
|
+
validates :actual_amount, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
13
13
|
|
14
14
|
belongs_to :sender_party, polymorphic: true
|
15
15
|
belongs_to :sender_agent, polymorphic: true
|
@@ -7,7 +7,7 @@ class Unidom::Shipment::ShipmentItem < Unidom::Shipment::ApplicationRecord
|
|
7
7
|
|
8
8
|
include Unidom::Common::Concerns::ModelExtension
|
9
9
|
|
10
|
-
validates :quantity, presence: true, numericality: { greater_than_or_equal_to: 0,
|
10
|
+
validates :quantity, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
11
11
|
|
12
12
|
belongs_to :shipment, class_name: 'Unidom::Shipment::Shipment'
|
13
13
|
belongs_to :shipped, polymorphic: true
|
@@ -18,27 +18,8 @@ describe Unidom::Shipment::ShipmentItem, type: :model do
|
|
18
18
|
|
19
19
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
20
20
|
|
21
|
-
it_behaves_like 'validates', model_attributes, :quantity,
|
22
|
-
|
23
|
-
{ quantity: nil } => 2,
|
24
|
-
{ quantity: '' } => 2,
|
25
|
-
{ quantity: '1' } => 0,
|
26
|
-
{ quantity: 1 } => 0,
|
27
|
-
{ quantity: 'A' } => 1,
|
28
|
-
{ quantity: '1.23' } => 0,
|
29
|
-
{ quantity: 1.23 } => 0,
|
30
|
-
{ quantity: '-0.01' } => 1,
|
31
|
-
{ quantity: -0.01 } => 1,
|
32
|
-
{ quantity: '0' } => 0,
|
33
|
-
{ quantity: 0 } => 0,
|
34
|
-
{ quantity: '0.01' } => 0,
|
35
|
-
{ quantity: 0.01 } => 0,
|
36
|
-
{ quantity: '999_999_999.99' } => 0,
|
37
|
-
{ quantity: 999_999_999.99 } => 0,
|
38
|
-
{ quantity: '1_000_000_000' } => 1,
|
39
|
-
{ quantity: 1_000_000_000 } => 1,
|
40
|
-
{ quantity: '1_000_000_000.01' } => 1,
|
41
|
-
{ quantity: 1_000_000_000.01 } => 1
|
21
|
+
it_behaves_like 'validates numericality', model_attributes, :quantity,
|
22
|
+
range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true
|
42
23
|
|
43
24
|
shipment_attributes = {
|
44
25
|
sender_party_id: SecureRandom.uuid,
|
@@ -39,49 +39,10 @@ describe Unidom::Shipment::Shipment, type: :model do
|
|
39
39
|
|
40
40
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
41
41
|
|
42
|
-
it_behaves_like 'validates', model_attributes, :estimated_amount,
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
{ estimated_amount: '1' } => 0,
|
47
|
-
{ estimated_amount: 1 } => 0,
|
48
|
-
{ estimated_amount: 'A' } => 1,
|
49
|
-
{ estimated_amount: '1.23' } => 0,
|
50
|
-
{ estimated_amount: 1.23 } => 0,
|
51
|
-
{ estimated_amount: '-0.01' } => 1,
|
52
|
-
{ estimated_amount: -0.01 } => 1,
|
53
|
-
{ estimated_amount: '0' } => 0,
|
54
|
-
{ estimated_amount: 0 } => 0,
|
55
|
-
{ estimated_amount: '0.01' } => 0,
|
56
|
-
{ estimated_amount: 0.01 } => 0,
|
57
|
-
{ estimated_amount: '999_999_999.99' } => 0,
|
58
|
-
{ estimated_amount: 999_999_999.99 } => 0,
|
59
|
-
{ estimated_amount: '1_000_000_000' } => 1,
|
60
|
-
{ estimated_amount: 1_000_000_000 } => 1,
|
61
|
-
{ estimated_amount: '1_000_000_000.01' } => 1,
|
62
|
-
{ estimated_amount: 1_000_000_000.01 } => 1
|
63
|
-
|
64
|
-
it_behaves_like 'validates', model_attributes, :actual_amount,
|
65
|
-
{ } => 0,
|
66
|
-
{ actual_amount: nil } => 2,
|
67
|
-
{ actual_amount: '' } => 2,
|
68
|
-
{ actual_amount: '1' } => 0,
|
69
|
-
{ actual_amount: 1 } => 0,
|
70
|
-
{ actual_amount: 'A' } => 1,
|
71
|
-
{ actual_amount: '1.23' } => 0,
|
72
|
-
{ actual_amount: 1.23 } => 0,
|
73
|
-
{ actual_amount: '-0.01' } => 1,
|
74
|
-
{ actual_amount: -0.01 } => 1,
|
75
|
-
{ actual_amount: '0' } => 0,
|
76
|
-
{ actual_amount: 0 } => 0,
|
77
|
-
{ actual_amount: '0.01' } => 0,
|
78
|
-
{ actual_amount: 0.01 } => 0,
|
79
|
-
{ actual_amount: '999_999_999.99' } => 0,
|
80
|
-
{ actual_amount: 999_999_999.99 } => 0,
|
81
|
-
{ actual_amount: '1_000_000_000' } => 1,
|
82
|
-
{ actual_amount: 1_000_000_000 } => 1,
|
83
|
-
{ actual_amount: '1_000_000_000.01' } => 1,
|
84
|
-
{ actual_amount: 1_000_000_000.01 } => 1
|
42
|
+
it_behaves_like 'validates numericality', model_attributes, :estimated_amount,
|
43
|
+
range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true
|
44
|
+
it_behaves_like 'validates numericality', model_attributes, :actual_amount,
|
45
|
+
range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true
|
85
46
|
|
86
47
|
shipment_item_1_attributes = {
|
87
48
|
shipped_id: SecureRandom.uuid,
|
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.5
|
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-
|
11
|
+
date: 2017-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|