unidom-score 1.1 → 1.1.1

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: 6724ce452edb920cb54f013247b45fb7c44cfb70
4
- data.tar.gz: 6a746a54f6e650d7dc420bc24c62b0daa1246b7c
3
+ metadata.gz: a587d9f1476820ffb55f48651d145d662da8336f
4
+ data.tar.gz: 97c064ec6bb3294a69a1a606944c12ac12f73f29
5
5
  SHA512:
6
- metadata.gz: 0c4774fc0b6c963243f037e37eacb4c0c641809de3a19d59cc62fb94e8290516a8dd838a6eea231dbcdff408ce23a0748da7ed9152cf97374adc78d03233fdba
7
- data.tar.gz: e5b95e970f864035c3673cf507ced80bef47c92611da9fb4f053e609aa15d5c7189d332a5799cc82e4a690723b44a2363594b62d78df41b1cce926a367e3fcc8
6
+ metadata.gz: 69d6188302a762cde125941e4ceef86589c79d09aa132314577a14b333b434672be3167756d0c1b255c45101a2c960492bfddc1efa973d364fa15d149c9a08f5
7
+ data.tar.gz: 0f6458a9957a5cfa55a2c4a83bb850d66bc5d355765dd2e183feadee614162f814562fe6158df0d1e74d4307e61525df7bb0089446c65539dcef3203073886ad
@@ -18,8 +18,43 @@ describe Unidom::Score::ScoreItem, type: :model do
18
18
  scored_on: Date.current
19
19
  }
20
20
 
21
+ title_max_length = described_class.columns_hash['title'].limit
22
+
21
23
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
22
24
 
25
+ it_behaves_like 'validates', model_attributes, :score,
26
+ { } => 0,
27
+ { score: nil } => 2,
28
+ { score: '' } => 2,
29
+ { score: '1' } => 0,
30
+ { score: 1 } => 0,
31
+ { score: 'A' } => 1,
32
+ { score: '0.00' } => 0,
33
+ { score: 0.00 } => 0,
34
+ { score: '-999_999_999.99' } => 0,
35
+ { score: -999_999_999.99 } => 0,
36
+ { score: '-1_000_000_000' } => 0,
37
+ { score: -1_000_000_000 } => 0,
38
+ { score: '-1_000_000_000.01' } => 1,
39
+ { score: -1_000_000_000.01 } => 1,
40
+ { score: '999_999_999.99' } => 0,
41
+ { score: 999_999_999.99 } => 0,
42
+ { score: '1_000_000_000' } => 0,
43
+ { score: 1_000_000_000 } => 0,
44
+ { score: '1_000_000_000.01' } => 1,
45
+ { score: 1_000_000_000.01 } => 1
46
+
47
+ it_behaves_like 'validates', model_attributes, :title,
48
+ { } => 0,
49
+ { title: nil } => 0,
50
+ { title: '' } => 0,
51
+ { title: 'A' } => 1,
52
+ { title: 'AA' } => 0,
53
+ { title: 'AAA' } => 0,
54
+ { title: 'A'*(title_max_length-1) } => 0,
55
+ { title: 'A'*title_max_length } => 0,
56
+ { title: 'A'*(title_max_length+1) } => 1
57
+
23
58
  end
24
59
 
25
60
  end
@@ -19,8 +19,43 @@ describe Unidom::Score::ScoreSheet, type: :model do
19
19
  scored_on: Date.current
20
20
  }
21
21
 
22
+ name_max_length = described_class.columns_hash['name'].limit
23
+
22
24
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
23
25
 
26
+ it_behaves_like 'validates', model_attributes, :score,
27
+ { } => 0,
28
+ { score: nil } => 2,
29
+ { score: '' } => 2,
30
+ { score: '1' } => 0,
31
+ { score: 1 } => 0,
32
+ { score: 'A' } => 1,
33
+ { score: '0.00' } => 0,
34
+ { score: 0.00 } => 0,
35
+ { score: '-999_999_999.99' } => 0,
36
+ { score: -999_999_999.99 } => 0,
37
+ { score: '-1_000_000_000' } => 0,
38
+ { score: -1_000_000_000 } => 0,
39
+ { score: '-1_000_000_000.01' } => 1,
40
+ { score: -1_000_000_000.01 } => 1,
41
+ { score: '999_999_999.99' } => 0,
42
+ { score: 999_999_999.99 } => 0,
43
+ { score: '1_000_000_000' } => 0,
44
+ { score: 1_000_000_000 } => 0,
45
+ { score: '1_000_000_000.01' } => 1,
46
+ { score: 1_000_000_000.01 } => 1
47
+
48
+ it_behaves_like 'validates', model_attributes, :name,
49
+ { } => 0,
50
+ { name: nil } => 0,
51
+ { name: '' } => 0,
52
+ { name: 'A' } => 1,
53
+ { name: 'AA' } => 0,
54
+ { name: 'AAA' } => 0,
55
+ { name: 'A'*(name_max_length-1) } => 0,
56
+ { name: 'A'*name_max_length } => 0,
57
+ { name: 'A'*(name_max_length+1) } => 1
58
+
24
59
  end
25
60
 
26
61
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Score
3
- VERSION = '1.1'.freeze
3
+ VERSION = '1.1.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unidom-score
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: 1.1.1
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-04 00:00:00.000000000 Z
11
+ date: 2017-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common