unidom-price 1.7.3 → 1.7.4

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: 7a7337d5ade7493a3ef1aadc3f8222d442a5b781
4
- data.tar.gz: 2a1ad1ac2acbf147d7e7e2e9857d104de4cdbed5
3
+ metadata.gz: af6155b7fa6b0db7e89984b77185841d4c17cb10
4
+ data.tar.gz: 65fa87de86bff3302a12c3053af1c7300e21b166
5
5
  SHA512:
6
- metadata.gz: 1ca6806c02dd96e1abd5737cdf63a89eb5b61042e096a61150606b65d512789e173575f1baef7f8a9cf39ca35e3a694fa815508b6cd6502a5f9f885ed69f4711
7
- data.tar.gz: c3bb8bd441a59d66f97f1bfcdbfca0dfd1a9d63e27af970cbb874f89e07accac0fcc3fa8dcebaf77c12e37af66f1accb4acc5149aff3152fc3cb3540ed718465
6
+ metadata.gz: 9f536bfcad78f27a142255a382b131a5fbf6e0546086cd9db70a28c89c07027dc63bbb9bb3321086937a83aa17a150eff95310e7922054e880e3ec80dd0c2b3e
7
+ data.tar.gz: 8f2d5fca12f00cba093737f6da900ee59d19872133162f3af77d228d983787927e4b328864a8535a41dbcbf62762d397c00e02b7d81a643e47c42ca197a03af2
@@ -9,7 +9,7 @@ class Unidom::Price::Price < Unidom::Price::ApplicationRecord
9
9
  include Unidom::Common::Concerns::ModelExtension
10
10
  include ProgneTapera::EnumCode
11
11
 
12
- validates :amount, presence: true, numericality: { greater_than: 0, less_than: 1_000_000_000 }
12
+ validates :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 :priced, polymorphic: true
15
15
  belongs_to :pricer, polymorphic: true
@@ -22,27 +22,8 @@ describe Unidom::Price::Price, 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, :amount,
26
- { } => 0,
27
- { amount: nil } => 2,
28
- { amount: '' } => 2,
29
- { amount: '1' } => 0,
30
- { amount: 1 } => 0,
31
- { amount: 'A' } => 1,
32
- { amount: '1.23' } => 0,
33
- { amount: 1.23 } => 0,
34
- { amount: '-0.01' } => 1,
35
- { amount: -0.01 } => 1,
36
- { amount: '0' } => 1,
37
- { amount: 0 } => 1,
38
- { amount: '0.01' } => 0,
39
- { amount: 0.01 } => 0,
40
- { amount: '999_999_999.99' } => 0,
41
- { amount: 999_999_999.99 } => 0,
42
- { amount: '1_000_000_000' } => 1,
43
- { amount: 1_000_000_000 } => 1,
44
- { amount: '1_000_000_000.01' } => 1,
45
- { amount: 1_000_000_000.01 } => 1
25
+ it_behaves_like 'validates numericality', model_attributes, :amount,
26
+ range: 0..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true
46
27
 
47
28
  it_behaves_like 'ProgneTapera::EnumCode', described_class.new(model_attributes), :calculation, Unidom::Price::Calculation
48
29
  it_behaves_like 'ProgneTapera::EnumCode', described_class.new(model_attributes), :charging, Unidom::Price::Charging
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Price
3
- VERSION = '1.7.3'.freeze
3
+ VERSION = '1.7.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-price
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.3
4
+ version: 1.7.4
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-12 00:00:00.000000000 Z
11
+ date: 2017-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common