unidom-order 1.4.2 → 1.5

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: e091e23d5b3eb27ad6a15956f79901c6cc293127
4
- data.tar.gz: 242b53a3e93e89b0ae87957c241acd016a15c572
3
+ metadata.gz: 3ef804d7a52a8b1ca3107ce3ee1f2515bb9d2155
4
+ data.tar.gz: d910e6067a9215d687c737e0a57468fdc0898851
5
5
  SHA512:
6
- metadata.gz: 4a1f3ca8d004687a472626259f5400dcaf8a2b5924c1eaf5cb0e5f1d4f15cf37cfbd53613ae2eb0b39908842f59b25704258b569a8f13edf112bde597d2c06a3
7
- data.tar.gz: 389637997d93c82734639e617a805757b50f4263298fe241637422eb88749cc9a6fdc658fb03f956c7999d01980db3f35e5697cb336373ea6a9fba7888daa27d
6
+ metadata.gz: 68c54aaa5e5c931ca2fd39a1e8e7a23c2efbf45fd179102e7aa391714ebb69f1fb7f260441f4703bc52eb73a5e8936c09dd734d2a9c27cfeb550c9fb75848351
7
+ data.tar.gz: 66c82269d37da6b2bbe5410743f7372fbd863d60378f954217e90d2146e78b81f7397ac4ee040d8339d861e0396e3b48f52af499c7fe8fe5a7829ee888937dee
data/README.md CHANGED
@@ -162,3 +162,18 @@ Unidom::Common.configure do |options|
162
162
 
163
163
  end
164
164
  ```
165
+
166
+
167
+
168
+ ## RSpec examples
169
+
170
+ ```ruby
171
+ # spec/models/unidom_spec.rb
172
+ require 'unidom/order/models_rspec'
173
+
174
+ # spec/types/unidom_spec.rb
175
+ require 'unidom/order/types_rspec'
176
+
177
+ # spec/validators/unidom_spec.rb
178
+ require 'unidom/order/validators_rspec'
179
+ ```
@@ -8,7 +8,7 @@ class Unidom::Order::OrderItem < Unidom::Order::ApplicationRecord
8
8
  include Unidom::Common::Concerns::ModelExtension
9
9
  include Unidom::Order::Concerns::AsAdjusted
10
10
 
11
- validates :ordinal, presence: true, numericality: { only_integer: true, greater_than: 0, less_than: 1_000_000_000 }
11
+ #validates :ordinal, presence: true, numericality: { only_integer: true, greater_than: 0, less_than: 1_000_000_000 }
12
12
  validates :unit_price, presence: true, numericality: { less_than: 1_000_000_000, greater_than: 0 }
13
13
  validates :quantity, presence: true, numericality: { less_than: 1_000_000_000, greater_than: 0 }
14
14
  validates :purchase_amount, presence: true, numericality: { less_than: 1_000_000_000, greater_than: 0 }
@@ -0,0 +1,23 @@
1
+ describe Unidom::Order::OrderAdjustment, type: :model do
2
+
3
+ before :each do
4
+ end
5
+
6
+ after :each do
7
+ end
8
+
9
+ context do
10
+
11
+ model_attributes = {
12
+ adjusted_id: SecureRandom.uuid,
13
+ adjusted_type: 'Unidom::Order::Adjusted::Mock',
14
+ adjustment_factor_code: Unidom::Order::AdjustmentFactor::DISCOUNT_ADJUSTMENT.code,
15
+ calculation_code: 'AMNT',
16
+ amount: 10.00
17
+ }
18
+
19
+ it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,28 @@
1
+ describe Unidom::Order::OrderItem, type: :model do
2
+
3
+ before :each do
4
+ end
5
+
6
+ after :each do
7
+ end
8
+
9
+ context do
10
+
11
+ model_attributes = {
12
+ order_id: SecureRandom.uuid,
13
+ ordered_id: SecureRandom.uuid,
14
+ ordered_type: 'Unidom::Order::Ordered::Mock',
15
+ placer_id: SecureRandom.uuid,
16
+ placer_type: 'Unidom::Order::Placer::Mock',
17
+ ordinal: 1,
18
+ unit_price: 10.00,
19
+ quantity: 12.00,
20
+ purchase_amount: 120.00,
21
+ subtotal_amount: 100.00
22
+ }
23
+
24
+ it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
25
+
26
+ end
27
+
28
+ end
@@ -0,0 +1,25 @@
1
+ describe Unidom::Order::Order, type: :model do
2
+
3
+ before :each do
4
+ end
5
+
6
+ after :each do
7
+ end
8
+
9
+ context do
10
+
11
+ model_attributes = {
12
+ placer_id: SecureRandom.uuid,
13
+ placer_type: 'Unidom::Order::Placer::Mock',
14
+ taker_id: SecureRandom.uuid,
15
+ taker_type: 'Unidom::Order::Taker::Mock',
16
+ number: '202001019527',
17
+ purchase_amount: 10.00,
18
+ aggregate_amount: 12.00
19
+ }
20
+
21
+ it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,17 @@
1
+ describe Unidom::Order::AdjustmentFactor, type: :type do
2
+
3
+ before :each do
4
+ end
5
+
6
+ after :each do
7
+ end
8
+
9
+ it_behaves_like 'ProgneTapera::EnumConfig', 6, [
10
+ { code: 'DSCT', name: 'discount_adjustment', localized_name: '折扣调整' },
11
+ { code: 'SCHG', name: 'surcharge_adjustment', localized_name: '额外费调整' },
12
+ { code: 'SLTX', name: 'sales_tax', localized_name: '销售税' },
13
+ { code: 'SPHD', name: 'shipping_and_handling_charges', localized_name: '装运和处理费' },
14
+ { code: 'FEES', name: 'fee', localized_name: '手续费' },
15
+ { code: 'MISC', name: 'miscellaneous_charge', localized_name: '杂项收费' } ]
16
+
17
+ end
@@ -0,0 +1,3 @@
1
+ require 'rspec/models/unidom/order/order_spec' unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Order::Order'
2
+ require 'rspec/models/unidom/order/order_item_spec' unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Order::OrderItem'
3
+ require 'rspec/models/unidom/order/order_adjustment_spec' unless Unidom::Common::Neglection.namespace_neglected? 'Unidom::Order::OrderAdjustment'
@@ -0,0 +1 @@
1
+ require 'rspec/types/unidom/order/adjustment_factor_spec'
File without changes
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Order
3
- VERSION = '1.4.2'.freeze
3
+ VERSION = '1.5'.freeze
4
4
  end
5
5
  end
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.4.2
4
+ version: '1.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-01-21 00:00:00.000000000 Z
11
+ date: 2017-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common
@@ -58,9 +58,16 @@ files:
58
58
  - db/migrate/20020601000000_create_unidom_orders.rb
59
59
  - db/migrate/20020602000000_create_unidom_order_items.rb
60
60
  - db/migrate/20020603000000_create_unidom_order_adjustments.rb
61
+ - lib/rspec/models/unidom/order/order_adjustment_spec.rb
62
+ - lib/rspec/models/unidom/order/order_item_spec.rb
63
+ - lib/rspec/models/unidom/order/order_spec.rb
64
+ - lib/rspec/types/unidom/order/adjustment_factor_spec.rb
61
65
  - lib/tasks/order_tasks.rake
62
66
  - lib/unidom/order.rb
63
67
  - lib/unidom/order/engine.rb
68
+ - lib/unidom/order/models_rspec.rb
69
+ - lib/unidom/order/types_rspec.rb
70
+ - lib/unidom/order/validators_rspec.rb
64
71
  - lib/unidom/order/version.rb
65
72
  homepage: https://github.com/topbitdu/unidom-order
66
73
  licenses: