unidom-action 1.17.4 → 1.17.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: 01604a436b7126e1e0a09899c873f5ef06687498
4
- data.tar.gz: c7c1757224a00e4552f558a2d3dd4495a6cdd2a5
3
+ metadata.gz: f0d94ea06ef32e0fc7cb598a865f86a991a7f57e
4
+ data.tar.gz: b022f30d4677b64441942ceeedeed154c30a5c3c
5
5
  SHA512:
6
- metadata.gz: ad366eddad9768caa2036b2fd26f6ebd9724a85fdd840ae57a59df5f99b3ff116785aa6cdf50c6fb6ad33143fac68664a05d4616f2101e95d0365849d296f513
7
- data.tar.gz: 4eb2b7d989fd26970fd8da9154015e0877c32794c88a64df84d2804f7161a03176a4fa34132dea406ca8e1d862f51e50d38e02e33bb0bac786c461981393fe9a
6
+ metadata.gz: 3590d94114317234d35df6510c76f3f6d41556fdbf1bd36819d2c4da3e999db59483878823a9a2bd1aa78204f9781a33e6f7b55717bb828024c69f69404dd431
7
+ data.tar.gz: 1a5ef60b2e06750e33b7359e82aa9a9dc2b09ed36af5a3ffd4cc61b0cc56829203940adc2fcd99d7c0db8f679586bef1685dbe89423b2c781496d2fe3bbeafbb
@@ -12,11 +12,11 @@ class Unidom::Action::Searching < Unidom::Action::ApplicationRecord
12
12
  validates :platform_name, presence: true, length: { maximum: self.columns_hash['platform_name'].limit }
13
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
14
 
15
- validates :found_count, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
16
- validates :shown_count, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
17
- validates :per_page, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
18
- validates :total_pages, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
19
- validates :current_page, presence: true, numericality: { integer_only: true, greater_than_or_equal_to: 0, less_than: 1_000_000_000 }
15
+ validates :found_count, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
16
+ validates :shown_count, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
17
+ validates :per_page, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
18
+ validates :total_pages, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
19
+ validates :current_page, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 0, less_than_or_equal_to: 1_000_000_000 }
20
20
 
21
21
  belongs_to :searcher_visitor, polymorphic: true
22
22
  belongs_to :searcher_party, polymorphic: true
@@ -90,6 +90,116 @@ describe Unidom::Action::Searching, type: :model do
90
90
  { platform_version: '1_000_000_001' } => 1,
91
91
  { platform_version: 1_000_000_001 } => 1
92
92
 
93
+ it_behaves_like 'validates', model_attributes, :found_count,
94
+ { } => 0,
95
+ { found_count: nil } => 2,
96
+ { found_count: '' } => 2,
97
+ { found_count: '1' } => 0,
98
+ { found_count: 1 } => 0,
99
+ { found_count: 'A' } => 1,
100
+ { found_count: '1.23' } => 1,
101
+ { found_count: 1.23 } => 1,
102
+ { found_count: '-0.01' } => 1,
103
+ { found_count: -0.01 } => 1,
104
+ { found_count: '0' } => 0,
105
+ { found_count: 0 } => 0,
106
+ { found_count: '0.01' } => 1,
107
+ { found_count: 0.01 } => 1,
108
+ { found_count: '999999999' } => 0,
109
+ { found_count: 999_999_999 } => 0,
110
+ { found_count: '1000000000' } => 0,
111
+ { found_count: 1_000_000_000 } => 0,
112
+ { found_count: '1_000_000_001' } => 1,
113
+ { found_count: 1_000_000_001 } => 1
114
+
115
+ it_behaves_like 'validates', model_attributes, :shown_count,
116
+ { } => 0,
117
+ { shown_count: nil } => 2,
118
+ { shown_count: '' } => 2,
119
+ { shown_count: '1' } => 0,
120
+ { shown_count: 1 } => 0,
121
+ { shown_count: 'A' } => 1,
122
+ { shown_count: '1.23' } => 1,
123
+ { shown_count: 1.23 } => 1,
124
+ { shown_count: '-0.01' } => 1,
125
+ { shown_count: -0.01 } => 1,
126
+ { shown_count: '0' } => 0,
127
+ { shown_count: 0 } => 0,
128
+ { shown_count: '0.01' } => 1,
129
+ { shown_count: 0.01 } => 1,
130
+ { shown_count: '999999999' } => 0,
131
+ { shown_count: 999_999_999 } => 0,
132
+ { shown_count: '1000000000' } => 0,
133
+ { shown_count: 1_000_000_000 } => 0,
134
+ { shown_count: '1_000_000_001' } => 1,
135
+ { shown_count: 1_000_000_001 } => 1
136
+
137
+ it_behaves_like 'validates', model_attributes, :per_page,
138
+ { } => 0,
139
+ { per_page: nil } => 2,
140
+ { per_page: '' } => 2,
141
+ { per_page: '1' } => 0,
142
+ { per_page: 1 } => 0,
143
+ { per_page: 'A' } => 1,
144
+ { per_page: '1.23' } => 1,
145
+ { per_page: 1.23 } => 1,
146
+ { per_page: '-0.01' } => 1,
147
+ { per_page: -0.01 } => 1,
148
+ { per_page: '0' } => 0,
149
+ { per_page: 0 } => 0,
150
+ { per_page: '0.01' } => 1,
151
+ { per_page: 0.01 } => 1,
152
+ { per_page: '999999999' } => 0,
153
+ { per_page: 999_999_999 } => 0,
154
+ { per_page: '1000000000' } => 0,
155
+ { per_page: 1_000_000_000 } => 0,
156
+ { per_page: '1_000_000_001' } => 1,
157
+ { per_page: 1_000_000_001 } => 1
158
+
159
+ it_behaves_like 'validates', model_attributes, :total_pages,
160
+ { } => 0,
161
+ { total_pages: nil } => 2,
162
+ { total_pages: '' } => 2,
163
+ { total_pages: '1' } => 0,
164
+ { total_pages: 1 } => 0,
165
+ { total_pages: 'A' } => 1,
166
+ { total_pages: '1.23' } => 1,
167
+ { total_pages: 1.23 } => 1,
168
+ { total_pages: '-0.01' } => 1,
169
+ { total_pages: -0.01 } => 1,
170
+ { total_pages: '0' } => 0,
171
+ { total_pages: 0 } => 0,
172
+ { total_pages: '0.01' } => 1,
173
+ { total_pages: 0.01 } => 1,
174
+ { total_pages: '999999999' } => 0,
175
+ { total_pages: 999_999_999 } => 0,
176
+ { total_pages: '1000000000' } => 0,
177
+ { total_pages: 1_000_000_000 } => 0,
178
+ { total_pages: '1_000_000_001' } => 1,
179
+ { total_pages: 1_000_000_001 } => 1
180
+
181
+ it_behaves_like 'validates', model_attributes, :current_page,
182
+ { } => 0,
183
+ { current_page: nil } => 2,
184
+ { current_page: '' } => 2,
185
+ { current_page: '1' } => 0,
186
+ { current_page: 1 } => 0,
187
+ { current_page: 'A' } => 1,
188
+ { current_page: '1.23' } => 1,
189
+ { current_page: 1.23 } => 1,
190
+ { current_page: '-0.01' } => 1,
191
+ { current_page: -0.01 } => 1,
192
+ { current_page: '0' } => 0,
193
+ { current_page: 0 } => 0,
194
+ { current_page: '0.01' } => 1,
195
+ { current_page: 0.01 } => 1,
196
+ { current_page: '999999999' } => 0,
197
+ { current_page: 999_999_999 } => 0,
198
+ { current_page: '1000000000' } => 0,
199
+ { current_page: 1_000_000_000 } => 0,
200
+ { current_page: '1_000_000_001' } => 1,
201
+ { current_page: 1_000_000_001 } => 1
202
+
93
203
  end
94
204
 
95
205
  end
@@ -1,5 +1,5 @@
1
1
  module Unidom
2
2
  module Action
3
- VERSION = '1.17.4'.freeze
3
+ VERSION = '1.17.5'.freeze
4
4
  end
5
5
  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
4
+ version: 1.17.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-07 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: unidom-common