unidom-action 1.17.3 → 1.17.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01604a436b7126e1e0a09899c873f5ef06687498
|
4
|
+
data.tar.gz: c7c1757224a00e4552f558a2d3dd4495a6cdd2a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad366eddad9768caa2036b2fd26f6ebd9724a85fdd840ae57a59df5f99b3ff116785aa6cdf50c6fb6ad33143fac68664a05d4616f2101e95d0365849d296f513
|
7
|
+
data.tar.gz: 4eb2b7d989fd26970fd8da9154015e0877c32794c88a64df84d2804f7161a03176a4fa34132dea406ca8e1d862f51e50d38e02e33bb0bac786c461981393fe9a
|
@@ -8,7 +8,10 @@ class Unidom::Action::Searching < Unidom::Action::ApplicationRecord
|
|
8
8
|
|
9
9
|
include Unidom::Common::Concerns::ModelExtension
|
10
10
|
|
11
|
-
validates :resource_name,
|
11
|
+
validates :resource_name, presence: true, length: { maximum: self.columns_hash['resource_name'].limit }
|
12
|
+
validates :platform_name, presence: true, length: { maximum: self.columns_hash['platform_name'].limit }
|
13
|
+
validates :platform_version, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
|
14
|
+
|
12
15
|
validates :found_count, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
|
13
16
|
validates :shown_count, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
|
14
17
|
validates :per_page, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
|
@@ -25,12 +25,71 @@ describe Unidom::Action::Searching, type: :model do
|
|
25
25
|
current_page: 2
|
26
26
|
}
|
27
27
|
|
28
|
+
resource_name_max_length = described_class.columns_hash['resource_name'].limit
|
29
|
+
platform_name_max_length = described_class.columns_hash['platform_name'].limit
|
30
|
+
|
28
31
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
29
32
|
|
30
33
|
it_behaves_like 'belongs_to', model_attributes, :reason, Unidom::Action::Reason, { name: 'Some Reason' }
|
31
34
|
|
32
35
|
it_behaves_like 'monomorphic scope', model_attributes, :caused_by, :reason
|
33
36
|
|
37
|
+
it_behaves_like 'validates', model_attributes, :resource_name,
|
38
|
+
{ } => 0,
|
39
|
+
{ resource_name: nil } => 1,
|
40
|
+
{ resource_name: '' } => 1,
|
41
|
+
{ resource_name: '1' } => 0,
|
42
|
+
{ resource_name: 'A' } => 0,
|
43
|
+
{ resource_name: '11' } => 0,
|
44
|
+
{ resource_name: 'AA' } => 0,
|
45
|
+
{ resource_name: '111' } => 0,
|
46
|
+
{ resource_name: 'AAA' } => 0,
|
47
|
+
{ resource_name: '1'*(resource_name_max_length-1) } => 0,
|
48
|
+
{ resource_name: 'A'*(resource_name_max_length-1) } => 0,
|
49
|
+
{ resource_name: '1'*resource_name_max_length } => 0,
|
50
|
+
{ resource_name: 'A'*resource_name_max_length } => 0,
|
51
|
+
{ resource_name: '1'*(resource_name_max_length+1) } => 1,
|
52
|
+
{ resource_name: 'A'*(resource_name_max_length+1) } => 1
|
53
|
+
|
54
|
+
it_behaves_like 'validates', model_attributes, :platform_name,
|
55
|
+
{ } => 0,
|
56
|
+
{ platform_name: nil } => 1,
|
57
|
+
{ platform_name: '' } => 1,
|
58
|
+
{ platform_name: '1' } => 0,
|
59
|
+
{ platform_name: 'A' } => 0,
|
60
|
+
{ platform_name: '11' } => 0,
|
61
|
+
{ platform_name: 'AA' } => 0,
|
62
|
+
{ platform_name: '111' } => 0,
|
63
|
+
{ platform_name: 'AAA' } => 0,
|
64
|
+
{ platform_name: '1'*(platform_name_max_length-1) } => 0,
|
65
|
+
{ platform_name: 'A'*(platform_name_max_length-1) } => 0,
|
66
|
+
{ platform_name: '1'*platform_name_max_length } => 0,
|
67
|
+
{ platform_name: 'A'*platform_name_max_length } => 0,
|
68
|
+
{ platform_name: '1'*(platform_name_max_length+1) } => 1,
|
69
|
+
{ platform_name: 'A'*(platform_name_max_length+1) } => 1
|
70
|
+
|
71
|
+
it_behaves_like 'validates', model_attributes, :platform_version,
|
72
|
+
{ } => 0,
|
73
|
+
{ platform_version: nil } => 2,
|
74
|
+
{ platform_version: '' } => 2,
|
75
|
+
{ platform_version: '1' } => 0,
|
76
|
+
{ platform_version: 1 } => 0,
|
77
|
+
{ platform_version: 'A' } => 1,
|
78
|
+
{ platform_version: '1.23' } => 1,
|
79
|
+
{ platform_version: 1.23 } => 1,
|
80
|
+
{ platform_version: '-0.01' } => 1,
|
81
|
+
{ platform_version: -0.01 } => 1,
|
82
|
+
{ platform_version: '0' } => 0,
|
83
|
+
{ platform_version: 0 } => 0,
|
84
|
+
{ platform_version: '0.01' } => 1,
|
85
|
+
{ platform_version: 0.01 } => 1,
|
86
|
+
{ platform_version: '999999999' } => 0,
|
87
|
+
{ platform_version: 999_999_999 } => 0,
|
88
|
+
{ platform_version: '1000000000' } => 0,
|
89
|
+
{ platform_version: 1_000_000_000 } => 0,
|
90
|
+
{ platform_version: '1_000_000_001' } => 1,
|
91
|
+
{ platform_version: 1_000_000_001 } => 1
|
92
|
+
|
34
93
|
end
|
35
94
|
|
36
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-action
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.17.
|
4
|
+
version: 1.17.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-
|
11
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|