unidom-score 1.1.4 → 1.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: 2c891605818a7e2af5ae1e1241461c6fe041b140
4
- data.tar.gz: 8ea05f1f13deec9e8e279ef8b5d2caed17407d61
3
+ metadata.gz: ca42a8e48ff6eb78860c747aa517a282fe01c58c
4
+ data.tar.gz: 667eecfd49f8b46fb5eb8082e2e901ad7885b840
5
5
  SHA512:
6
- metadata.gz: 8e30d2506d30b8b87e5c8ed5c44b665cf79aeb12cef7781ef72655fd091d8b245619b93c93bad5153e4f1c5183e6ea068c646b20987f03fd9188fbe4a878e371
7
- data.tar.gz: 4f85de5a9cf80bf254428089ffa38519a9ead57d8763605be8596fd376b623fff6cb575ee92c9441b60d7fba152c210e123471e30da58f5eaff6191d0d6b687b
6
+ metadata.gz: abce5258947fd83d0a7010479891af132a31759d83996debafa10fe0f6d2d69511e2c6c085e22cfabb5c790c6a25178f56a4b9c0ea9bba5bf78371e534f291dc
7
+ data.tar.gz: bd7aad8034eccaa11cf480f8b22219b29fb4d4aae23de5c90416e2e32378807b076f3d2716b30ca59e5c599a112706345f20ead774df3c2d6d324b2ef24aab9b
@@ -19,42 +19,13 @@ 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
-
24
22
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
25
23
 
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
24
+ it_behaves_like 'validates text', model_attributes, :name,
25
+ length: 2..described_class.columns_hash['name'].limit
47
26
 
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
27
+ it_behaves_like 'validates numericality', model_attributes, :score,
28
+ range: -1_000_000_000..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: false
58
29
 
59
30
  score_sheet_template_attributes = {
60
31
  subject_id: SecureRandom.uuid,
@@ -17,6 +17,12 @@ describe Unidom::Score::ScoreSheetTemplate, type: :model do
17
17
 
18
18
  it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
19
19
 
20
+ it_behaves_like 'validates text', model_attributes, :name,
21
+ length: 2..described_class.columns_hash['name'].limit
22
+
23
+ it_behaves_like 'validates numericality', model_attributes, :score,
24
+ range: -1_000_000_000..1_000_000_000, minimum_inclusive: true, maximum_inclusive: true, only_integer: false
25
+
20
26
  end
21
27
 
22
28
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Score
3
- VERSION = '1.1.4'.freeze
3
+ VERSION = '1.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-score
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.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-03-23 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common