unidom-order 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/unidom/order/order_item.rb +1 -1
- data/lib/rspec/models/unidom/order/order_adjustment_spec.rb +26 -0
- data/lib/rspec/models/unidom/order/order_item_spec.rb +2 -0
- data/lib/rspec/models/unidom/order/order_spec.rb +3 -0
- data/lib/unidom/order/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: 47c98786e6271f1089c7b6496ffdabfe5e025bbb
|
4
|
+
data.tar.gz: b70f21a33fa5b80d831e2ce69fafa5ed13f31f86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 986bd454ecd0d4d8235efc213baa888a016d9bb0ba110dc0be5b0c4f19c240ef19780ce53d670a218cc0270d09090022572a5fc1c4975c5210b8b97bc7bb6808
|
7
|
+
data.tar.gz: bc6b8da172abb251afb8800dbfc2bc6d53307a71fdac6a5fdbb0e66e96e9e05e8a096808427fcc31187def45e98ebaf99fe09103572b8033ade8288a64663ca3
|
@@ -18,7 +18,7 @@ class Unidom::Order::OrderItem < Unidom::Order::ApplicationRecord
|
|
18
18
|
belongs_to :ordered, polymorphic: true
|
19
19
|
belongs_to :placer, polymorphic: true
|
20
20
|
|
21
|
-
scope :order_is, ->(order) { where
|
21
|
+
scope :order_is, ->(order) { where order: order }
|
22
22
|
scope :ordered_is, ->(ordered) { where ordered: ordered }
|
23
23
|
scope :placed_by, ->(placer) { where placer: placer }
|
24
24
|
|
@@ -48,6 +48,32 @@ describe Unidom::Order::OrderAdjustment, type: :model do
|
|
48
48
|
|
49
49
|
it_behaves_like 'ProgneTapera::EnumCode', described_class.new(model_attributes), :adjustment_factor, Unidom::Order::AdjustmentFactor
|
50
50
|
|
51
|
+
order_attributes = {
|
52
|
+
placer_id: SecureRandom.uuid,
|
53
|
+
placer_type: 'Unidom::Order::Placer::Mock',
|
54
|
+
taker_id: SecureRandom.uuid,
|
55
|
+
taker_type: 'Unidom::Order::Taker::Mock',
|
56
|
+
number: '202001019527',
|
57
|
+
purchase_amount: 10.00,
|
58
|
+
aggregate_amount: 12.00
|
59
|
+
}
|
60
|
+
|
61
|
+
order_item_attributes = {
|
62
|
+
order_id: SecureRandom.uuid,
|
63
|
+
ordered_id: SecureRandom.uuid,
|
64
|
+
ordered_type: 'Unidom::Order::Ordered::Mock',
|
65
|
+
placer_id: SecureRandom.uuid,
|
66
|
+
placer_type: 'Unidom::Order::Placer::Mock',
|
67
|
+
ordinal: 1,
|
68
|
+
unit_price: 10.00,
|
69
|
+
quantity: 12.00,
|
70
|
+
purchase_amount: 120.00,
|
71
|
+
subtotal_amount: 100.00
|
72
|
+
}
|
73
|
+
|
74
|
+
it_behaves_like 'belongs_to', model_attributes, :adjusted, Unidom::Order::Order, order_attributes
|
75
|
+
it_behaves_like 'belongs_to', model_attributes, :adjusted, Unidom::Order::OrderItem, order_item_attributes
|
76
|
+
|
51
77
|
end
|
52
78
|
|
53
79
|
end
|
@@ -123,6 +123,8 @@ describe Unidom::Order::OrderItem, type: :model do
|
|
123
123
|
|
124
124
|
it_behaves_like 'belongs_to', model_attributes, :order, Unidom::Order::Order, order_attributes
|
125
125
|
|
126
|
+
it_behaves_like 'monomorphic scope', model_attributes, :order_is, :order
|
127
|
+
|
126
128
|
end
|
127
129
|
|
128
130
|
end
|
@@ -79,6 +79,9 @@ describe Unidom::Order::Order, type: :model do
|
|
79
79
|
{ aggregate_amount: '1_000_000_000.01' } => 1,
|
80
80
|
{ aggregate_amount: 1_000_000_000.01 } => 1
|
81
81
|
|
82
|
+
#it_behaves_like 'validates numericality', model_attributes, :purchase_amount
|
83
|
+
#it_behaves_like 'validates numericality', model_attributes, :aggregate_amount
|
84
|
+
|
82
85
|
order_item_1_attributes = {
|
83
86
|
ordered_id: SecureRandom.uuid,
|
84
87
|
ordered_type: 'Unidom::Order::Ordered::Mock',
|
data/lib/unidom/order/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-order
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.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-
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|