standardapi 5.0.0.15 → 5.0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/standard_api/test_case.rb +0 -38
- data/lib/standard_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6782bdd5356588527128321b446a0c5a6bdeca55
|
4
|
+
data.tar.gz: 8697b08b5b8142729f08071e436d1bea6441fe13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b611aa8ec70e27b99ed965d97000fcc8c8eb4dfafdee5eb39eb7c31260243d92960041a91deb8760c65dde303ea6d6ea49e6d3106491582ff32896490ee3051d
|
7
|
+
data.tar.gz: 0aae715b906024759bc25e12761bc7695865da1152a62b80fdbbeafbf6f43958b716ca05666a0f5a8a9a04342217f59eee32b630faa2aef0c55b2409a406e5f3
|
@@ -153,44 +153,6 @@ module StandardAPI::TestCase
|
|
153
153
|
raise e if e.message != "uninitialized constant #{controller_class_name}"
|
154
154
|
end
|
155
155
|
|
156
|
-
def include_filter_tests
|
157
|
-
model.attribute_names.each do |filter|
|
158
|
-
define_method("test_model_filter_#{filter}") do
|
159
|
-
m = create_model
|
160
|
-
value = m.send(filter)
|
161
|
-
|
162
|
-
assert_predicate = -> (predicate) {
|
163
|
-
get "/#{controller_class.controller_path}.json", params: { where: predicate, format: 'json' }
|
164
|
-
assert_equal model.filter(predicate).order('id ASC').to_sql, assigns(plural_name).to_sql
|
165
|
-
}
|
166
|
-
|
167
|
-
# TODO: Test array
|
168
|
-
case model.columns_hash[filter.to_s].type
|
169
|
-
when :jsonb, :json # JSON
|
170
|
-
assert_predicate.call({ filter => value })
|
171
|
-
else
|
172
|
-
case value
|
173
|
-
when Array
|
174
|
-
assert_predicate.call({ filter => value }) # Overlaps
|
175
|
-
assert_predicate.call({ filter => value[0] }) # Contains
|
176
|
-
else
|
177
|
-
assert_predicate.call({ filter => value }) # Equality
|
178
|
-
assert_predicate.call({ filter => { gt: value } }) # Greater Than
|
179
|
-
assert_predicate.call({ filter => { greater_than: value } })
|
180
|
-
assert_predicate.call({ filter => { lt: value } }) # Less Than
|
181
|
-
assert_predicate.call({ filter => { less_than: value } })
|
182
|
-
assert_predicate.call({ filter => { gte: value } }) # Greater Than or Equal To
|
183
|
-
assert_predicate.call({ filter => { gteq: value } })
|
184
|
-
assert_predicate.call({ filter => { greater_than_or_equal_to: value } })
|
185
|
-
assert_predicate.call({ filter => { lte: value } }) # Less Than or Equal To
|
186
|
-
assert_predicate.call({ filter => { lteq: value } })
|
187
|
-
assert_predicate.call({ filter => { less_than_or_equal_to: value } })
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
156
|
def model=(val)
|
195
157
|
@model = val
|
196
158
|
self.filters = val.attribute_names
|
data/lib/standard_api/version.rb
CHANGED