opensearch-dsl 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +0 -0
  3. data/.gitignore +17 -0
  4. data/Gemfile +51 -0
  5. data/LICENSE +202 -0
  6. data/README.md +149 -0
  7. data/Rakefile +234 -0
  8. data/lib/opensearch/dsl/search/aggregation.rb +110 -0
  9. data/lib/opensearch/dsl/search/aggregations/avg.rb +51 -0
  10. data/lib/opensearch/dsl/search/aggregations/cardinality.rb +58 -0
  11. data/lib/opensearch/dsl/search/aggregations/children.rb +65 -0
  12. data/lib/opensearch/dsl/search/aggregations/composite.rb +68 -0
  13. data/lib/opensearch/dsl/search/aggregations/date_histogram.rb +66 -0
  14. data/lib/opensearch/dsl/search/aggregations/date_range.rb +60 -0
  15. data/lib/opensearch/dsl/search/aggregations/extended_stats.rb +50 -0
  16. data/lib/opensearch/dsl/search/aggregations/filter.rb +56 -0
  17. data/lib/opensearch/dsl/search/aggregations/filters.rb +61 -0
  18. data/lib/opensearch/dsl/search/aggregations/geo_bounds.rb +70 -0
  19. data/lib/opensearch/dsl/search/aggregations/geo_distance.rb +65 -0
  20. data/lib/opensearch/dsl/search/aggregations/geohash_grid.rb +61 -0
  21. data/lib/opensearch/dsl/search/aggregations/global.rb +54 -0
  22. data/lib/opensearch/dsl/search/aggregations/histogram.rb +61 -0
  23. data/lib/opensearch/dsl/search/aggregations/ip_range.rb +57 -0
  24. data/lib/opensearch/dsl/search/aggregations/max.rb +51 -0
  25. data/lib/opensearch/dsl/search/aggregations/min.rb +51 -0
  26. data/lib/opensearch/dsl/search/aggregations/missing.rb +61 -0
  27. data/lib/opensearch/dsl/search/aggregations/nested.rb +59 -0
  28. data/lib/opensearch/dsl/search/aggregations/percentile_ranks.rb +60 -0
  29. data/lib/opensearch/dsl/search/aggregations/percentiles.rb +59 -0
  30. data/lib/opensearch/dsl/search/aggregations/pipeline/avg_bucket.rb +59 -0
  31. data/lib/opensearch/dsl/search/aggregations/pipeline/bucket_script.rb +61 -0
  32. data/lib/opensearch/dsl/search/aggregations/pipeline/bucket_selector.rb +60 -0
  33. data/lib/opensearch/dsl/search/aggregations/pipeline/bucket_sort.rb +114 -0
  34. data/lib/opensearch/dsl/search/aggregations/pipeline/cumulative_sum.rb +58 -0
  35. data/lib/opensearch/dsl/search/aggregations/pipeline/derivative.rb +59 -0
  36. data/lib/opensearch/dsl/search/aggregations/pipeline/extended_stats_bucket.rb +59 -0
  37. data/lib/opensearch/dsl/search/aggregations/pipeline/max_bucket.rb +59 -0
  38. data/lib/opensearch/dsl/search/aggregations/pipeline/min_bucket.rb +59 -0
  39. data/lib/opensearch/dsl/search/aggregations/pipeline/moving_avg.rb +67 -0
  40. data/lib/opensearch/dsl/search/aggregations/pipeline/percentiles_bucket.rb +61 -0
  41. data/lib/opensearch/dsl/search/aggregations/pipeline/serial_diff.rb +61 -0
  42. data/lib/opensearch/dsl/search/aggregations/pipeline/stats_bucket.rb +59 -0
  43. data/lib/opensearch/dsl/search/aggregations/pipeline/sum_bucket.rb +59 -0
  44. data/lib/opensearch/dsl/search/aggregations/range.rb +79 -0
  45. data/lib/opensearch/dsl/search/aggregations/reverse_nested.rb +63 -0
  46. data/lib/opensearch/dsl/search/aggregations/scripted_metric.rb +65 -0
  47. data/lib/opensearch/dsl/search/aggregations/significant_terms.rb +71 -0
  48. data/lib/opensearch/dsl/search/aggregations/stats.rb +63 -0
  49. data/lib/opensearch/dsl/search/aggregations/sum.rb +51 -0
  50. data/lib/opensearch/dsl/search/aggregations/terms.rb +68 -0
  51. data/lib/opensearch/dsl/search/aggregations/top_hits.rb +61 -0
  52. data/lib/opensearch/dsl/search/aggregations/value_count.rb +51 -0
  53. data/lib/opensearch/dsl/search/base_aggregation_component.rb +90 -0
  54. data/lib/opensearch/dsl/search/base_component.rb +193 -0
  55. data/lib/opensearch/dsl/search/base_compound_filter_component.rb +123 -0
  56. data/lib/opensearch/dsl/search/filter.rb +81 -0
  57. data/lib/opensearch/dsl/search/filters/and.rb +71 -0
  58. data/lib/opensearch/dsl/search/filters/bool.rb +105 -0
  59. data/lib/opensearch/dsl/search/filters/exists.rb +58 -0
  60. data/lib/opensearch/dsl/search/filters/geo_bounding_box.rb +71 -0
  61. data/lib/opensearch/dsl/search/filters/geo_distance.rb +83 -0
  62. data/lib/opensearch/dsl/search/filters/geo_distance_range.rb +58 -0
  63. data/lib/opensearch/dsl/search/filters/geo_polygon.rb +67 -0
  64. data/lib/opensearch/dsl/search/filters/geo_shape.rb +61 -0
  65. data/lib/opensearch/dsl/search/filters/geohash_cell.rb +72 -0
  66. data/lib/opensearch/dsl/search/filters/has_child.rb +100 -0
  67. data/lib/opensearch/dsl/search/filters/has_parent.rb +99 -0
  68. data/lib/opensearch/dsl/search/filters/ids.rb +58 -0
  69. data/lib/opensearch/dsl/search/filters/indices.rb +103 -0
  70. data/lib/opensearch/dsl/search/filters/limit.rb +57 -0
  71. data/lib/opensearch/dsl/search/filters/match_all.rb +54 -0
  72. data/lib/opensearch/dsl/search/filters/missing.rb +60 -0
  73. data/lib/opensearch/dsl/search/filters/nested.rb +93 -0
  74. data/lib/opensearch/dsl/search/filters/not.rb +99 -0
  75. data/lib/opensearch/dsl/search/filters/or.rb +71 -0
  76. data/lib/opensearch/dsl/search/filters/prefix.rb +55 -0
  77. data/lib/opensearch/dsl/search/filters/query.rb +80 -0
  78. data/lib/opensearch/dsl/search/filters/range.rb +65 -0
  79. data/lib/opensearch/dsl/search/filters/regexp.rb +60 -0
  80. data/lib/opensearch/dsl/search/filters/script.rb +58 -0
  81. data/lib/opensearch/dsl/search/filters/term.rb +57 -0
  82. data/lib/opensearch/dsl/search/filters/terms.rb +58 -0
  83. data/lib/opensearch/dsl/search/filters/type.rb +60 -0
  84. data/lib/opensearch/dsl/search/highlight.rb +117 -0
  85. data/lib/opensearch/dsl/search/options.rb +81 -0
  86. data/lib/opensearch/dsl/search/queries/bool.rb +111 -0
  87. data/lib/opensearch/dsl/search/queries/boosting.rb +59 -0
  88. data/lib/opensearch/dsl/search/queries/common.rb +64 -0
  89. data/lib/opensearch/dsl/search/queries/constant_score.rb +92 -0
  90. data/lib/opensearch/dsl/search/queries/dis_max.rb +61 -0
  91. data/lib/opensearch/dsl/search/queries/exists.rb +69 -0
  92. data/lib/opensearch/dsl/search/queries/filtered.rb +103 -0
  93. data/lib/opensearch/dsl/search/queries/function_score.rb +128 -0
  94. data/lib/opensearch/dsl/search/queries/fuzzy.rb +71 -0
  95. data/lib/opensearch/dsl/search/queries/fuzzy_like_this.rb +63 -0
  96. data/lib/opensearch/dsl/search/queries/fuzzy_like_this_field.rb +62 -0
  97. data/lib/opensearch/dsl/search/queries/geo_shape.rb +56 -0
  98. data/lib/opensearch/dsl/search/queries/has_child.rb +84 -0
  99. data/lib/opensearch/dsl/search/queries/has_parent.rb +84 -0
  100. data/lib/opensearch/dsl/search/queries/ids.rb +54 -0
  101. data/lib/opensearch/dsl/search/queries/indices.rb +60 -0
  102. data/lib/opensearch/dsl/search/queries/match.rb +69 -0
  103. data/lib/opensearch/dsl/search/queries/match_all.rb +52 -0
  104. data/lib/opensearch/dsl/search/queries/match_phrase.rb +58 -0
  105. data/lib/opensearch/dsl/search/queries/match_phrase_prefix.rb +57 -0
  106. data/lib/opensearch/dsl/search/queries/more_like_this.rb +90 -0
  107. data/lib/opensearch/dsl/search/queries/multi_match.rb +71 -0
  108. data/lib/opensearch/dsl/search/queries/nested.rb +82 -0
  109. data/lib/opensearch/dsl/search/queries/prefix.rb +56 -0
  110. data/lib/opensearch/dsl/search/queries/query_string.rb +77 -0
  111. data/lib/opensearch/dsl/search/queries/range.rb +73 -0
  112. data/lib/opensearch/dsl/search/queries/regexp.rb +57 -0
  113. data/lib/opensearch/dsl/search/queries/simple_query_string.rb +66 -0
  114. data/lib/opensearch/dsl/search/queries/span_first.rb +54 -0
  115. data/lib/opensearch/dsl/search/queries/span_multi.rb +54 -0
  116. data/lib/opensearch/dsl/search/queries/span_near.rb +58 -0
  117. data/lib/opensearch/dsl/search/queries/span_not.rb +59 -0
  118. data/lib/opensearch/dsl/search/queries/span_or.rb +54 -0
  119. data/lib/opensearch/dsl/search/queries/span_term.rb +52 -0
  120. data/lib/opensearch/dsl/search/queries/template.rb +57 -0
  121. data/lib/opensearch/dsl/search/queries/term.rb +52 -0
  122. data/lib/opensearch/dsl/search/queries/terms.rb +53 -0
  123. data/lib/opensearch/dsl/search/queries/top_children.rb +84 -0
  124. data/lib/opensearch/dsl/search/queries/wildcard.rb +56 -0
  125. data/lib/opensearch/dsl/search/query.rb +80 -0
  126. data/lib/opensearch/dsl/search/sort.rb +84 -0
  127. data/lib/opensearch/dsl/search/suggest.rb +53 -0
  128. data/lib/opensearch/dsl/search.rb +288 -0
  129. data/lib/opensearch/dsl/utils.rb +51 -0
  130. data/lib/opensearch/dsl/version.rb +31 -0
  131. data/lib/opensearch/dsl.rb +72 -0
  132. data/lib/opensearch-dsl.rb +27 -0
  133. data/opensearch-dsl.gemspec +81 -0
  134. data/spec/opensearch/dsl/search/aggregations/avg_spec.rb +52 -0
  135. data/spec/opensearch/dsl/search/aggregations/cardinality_spec.rb +119 -0
  136. data/spec/opensearch/dsl/search/aggregations/children_spec.rb +75 -0
  137. data/spec/opensearch/dsl/search/aggregations/composite_spec.rb +108 -0
  138. data/spec/opensearch/dsl/search/aggregations/date_histogram_spec.rb +198 -0
  139. data/spec/opensearch/dsl/search/aggregations/date_range_spec.rb +98 -0
  140. data/spec/opensearch/dsl/search/aggregations/extended_stats_spec.rb +52 -0
  141. data/spec/opensearch/dsl/search/aggregations/filter_spec.rb +57 -0
  142. data/spec/opensearch/dsl/search/aggregations/filters_spec.rb +98 -0
  143. data/spec/opensearch/dsl/search/aggregations/geo_bounds_spec.rb +86 -0
  144. data/spec/opensearch/dsl/search/aggregations/geo_distance_spec.rb +122 -0
  145. data/spec/opensearch/dsl/search/aggregations/geo_grid_spec.rb +109 -0
  146. data/spec/opensearch/dsl/search/aggregations/global_spec.rb +71 -0
  147. data/spec/opensearch/dsl/search/aggregations/historgram_spec.rb +131 -0
  148. data/spec/opensearch/dsl/search/aggregations/ip_range_spec.rb +102 -0
  149. data/spec/opensearch/dsl/search/aggregations/max_spec.rb +52 -0
  150. data/spec/opensearch/dsl/search/aggregations/min_spec.rb +52 -0
  151. data/spec/opensearch/dsl/search/aggregations/missing_spec.rb +90 -0
  152. data/spec/opensearch/dsl/search/aggregations/nested_spec.rb +95 -0
  153. data/spec/opensearch/dsl/search/aggregations/percentile_ranks_spec.rb +135 -0
  154. data/spec/opensearch/dsl/search/aggregations/percentiles_spec.rb +134 -0
  155. data/spec/opensearch/dsl/search/aggregations/pipeline/avg_bucket_spec.rb +97 -0
  156. data/spec/opensearch/dsl/search/aggregations/pipeline/bucket_script_spec.rb +108 -0
  157. data/spec/opensearch/dsl/search/aggregations/pipeline/bucket_selector_spec.rb +97 -0
  158. data/spec/opensearch/dsl/search/aggregations/pipeline/bucket_sort_spec.rb +113 -0
  159. data/spec/opensearch/dsl/search/aggregations/pipeline/cumulative_sum_spec.rb +86 -0
  160. data/spec/opensearch/dsl/search/aggregations/pipeline/derivative_spec.rb +97 -0
  161. data/spec/opensearch/dsl/search/aggregations/pipeline/extended_stats_bucket_spec.rb +97 -0
  162. data/spec/opensearch/dsl/search/aggregations/pipeline/max_bucket_spec.rb +97 -0
  163. data/spec/opensearch/dsl/search/aggregations/pipeline/min_bucket_spec.rb +97 -0
  164. data/spec/opensearch/dsl/search/aggregations/pipeline/moving_avg_test_spec.rb +141 -0
  165. data/spec/opensearch/dsl/search/aggregations/pipeline/percentiles_bucket_spec.rb +108 -0
  166. data/spec/opensearch/dsl/search/aggregations/pipeline/serial_diff_spec.rb +108 -0
  167. data/spec/opensearch/dsl/search/aggregations/pipeline/stats_bucket_spec.rb +97 -0
  168. data/spec/opensearch/dsl/search/aggregations/pipeline/sum_bucket_spec.rb +97 -0
  169. data/spec/opensearch/dsl/search/aggregations/range_spec.rb +128 -0
  170. data/spec/opensearch/dsl/search/aggregations/reverse_nested_spec.rb +41 -0
  171. data/spec/opensearch/dsl/search/aggregations/scripted_metric_spec.rb +130 -0
  172. data/spec/opensearch/dsl/search/aggregations/significant_terms_spec.rb +185 -0
  173. data/spec/opensearch/dsl/search/aggregations/stats_spec.rb +65 -0
  174. data/spec/opensearch/dsl/search/aggregations/sum_spec.rb +52 -0
  175. data/spec/opensearch/dsl/search/aggregations/terms_spec.rb +174 -0
  176. data/spec/opensearch/dsl/search/aggregations/top_hits_spec.rb +97 -0
  177. data/spec/opensearch/dsl/search/aggregations/value_count_spec.rb +52 -0
  178. data/spec/opensearch/dsl/search/filters/and_spec.rb +83 -0
  179. data/spec/opensearch/dsl/search/filters/bool_spec.rb +208 -0
  180. data/spec/opensearch/dsl/search/filters/exists_spec.rb +75 -0
  181. data/spec/opensearch/dsl/search/filters/geo_bounding_box_spec.rb +153 -0
  182. data/spec/opensearch/dsl/search/filters/geo_distance_range_spec.rb +112 -0
  183. data/spec/opensearch/dsl/search/filters/geo_distance_spec.rb +135 -0
  184. data/spec/opensearch/dsl/search/filters/geo_polygon_spec.rb +75 -0
  185. data/spec/opensearch/dsl/search/filters/geo_shape_spec.rb +86 -0
  186. data/spec/opensearch/dsl/search/filters/geohash_cell_spec.rb +108 -0
  187. data/spec/opensearch/dsl/search/filters/has_child_spec.rb +148 -0
  188. data/spec/opensearch/dsl/search/filters/has_parent_spec.rb +137 -0
  189. data/spec/opensearch/dsl/search/filters/ids_spec.rb +87 -0
  190. data/spec/opensearch/dsl/search/filters/indices_spec.rb +118 -0
  191. data/spec/opensearch/dsl/search/filters/limit_spec.rb +75 -0
  192. data/spec/opensearch/dsl/search/filters/match_all_spec.rb +41 -0
  193. data/spec/opensearch/dsl/search/filters/missing_spec.rb +75 -0
  194. data/spec/opensearch/dsl/search/filters/nested_spec.rb +100 -0
  195. data/spec/opensearch/dsl/search/filters/not_spec.rb +68 -0
  196. data/spec/opensearch/dsl/search/filters/or_spec.rb +84 -0
  197. data/spec/opensearch/dsl/search/filters/prefix_spec.rb +55 -0
  198. data/spec/opensearch/dsl/search/filters/query_spec.rb +68 -0
  199. data/spec/opensearch/dsl/search/filters/range_spec.rb +120 -0
  200. data/spec/opensearch/dsl/search/filters/regexp_spec.rb +97 -0
  201. data/spec/opensearch/dsl/search/filters/script_spec.rb +86 -0
  202. data/spec/opensearch/dsl/search/filters/term_spec.rb +66 -0
  203. data/spec/opensearch/dsl/search/filters/terms_spec.rb +55 -0
  204. data/spec/opensearch/dsl/search/filters/type_spec.rb +75 -0
  205. data/spec/opensearch/dsl/search/queries/bool_spec.rb +276 -0
  206. data/spec/opensearch/dsl/search/queries/boosting_spec.rb +99 -0
  207. data/spec/opensearch/dsl/search/queries/common_spec.rb +141 -0
  208. data/spec/opensearch/dsl/search/queries/constant_score_spec.rb +99 -0
  209. data/spec/opensearch/dsl/search/queries/dis_max_spec.rb +97 -0
  210. data/spec/opensearch/dsl/search/queries/exists_spec.rb +75 -0
  211. data/spec/opensearch/dsl/search/queries/filtered_spec.rb +102 -0
  212. data/spec/opensearch/dsl/search/queries/function_score_spec.rb +173 -0
  213. data/spec/opensearch/dsl/search/queries/fuzzy_like_this_field_spec.rb +141 -0
  214. data/spec/opensearch/dsl/search/queries/fuzzy_like_this_spec.rb +143 -0
  215. data/spec/opensearch/dsl/search/queries/fuzzy_spec.rb +119 -0
  216. data/spec/opensearch/dsl/search/queries/geo_shape_spec.rb +86 -0
  217. data/spec/opensearch/dsl/search/queries/has_child_spec.rb +135 -0
  218. data/spec/opensearch/dsl/search/queries/has_parent_spec.rb +109 -0
  219. data/spec/opensearch/dsl/search/queries/ids_spec.rb +87 -0
  220. data/spec/opensearch/dsl/search/queries/indices_spec.rb +98 -0
  221. data/spec/opensearch/dsl/search/queries/match_all_spec.rb +75 -0
  222. data/spec/opensearch/dsl/search/queries/match_phrase_prefix_spec.rb +112 -0
  223. data/spec/opensearch/dsl/search/queries/match_phrase_spec.rb +123 -0
  224. data/spec/opensearch/dsl/search/queries/match_spec.rb +116 -0
  225. data/spec/opensearch/dsl/search/queries/more_like_this_spec.rb +96 -0
  226. data/spec/opensearch/dsl/search/queries/multi_match_spec.rb +83 -0
  227. data/spec/opensearch/dsl/search/queries/nested_spec.rb +107 -0
  228. data/spec/opensearch/dsl/search/queries/prefix_spec.rb +79 -0
  229. data/spec/opensearch/dsl/search/queries/query_string_spec.rb +98 -0
  230. data/spec/opensearch/dsl/search/queries/range_spec.rb +87 -0
  231. data/spec/opensearch/dsl/search/queries/regexp_spec.rb +91 -0
  232. data/spec/opensearch/dsl/search/queries/simple_query_string_spec.rb +83 -0
  233. data/spec/opensearch/dsl/search/queries/span_first_spec.rb +78 -0
  234. data/spec/opensearch/dsl/search/queries/span_multi_spec.rb +78 -0
  235. data/spec/opensearch/dsl/search/queries/span_near_spec.rb +81 -0
  236. data/spec/opensearch/dsl/search/queries/span_not_spec.rb +82 -0
  237. data/spec/opensearch/dsl/search/queries/span_or_spec.rb +78 -0
  238. data/spec/opensearch/dsl/search/queries/span_term_spec.rb +55 -0
  239. data/spec/opensearch/dsl/search/queries/template_spec.rb +93 -0
  240. data/spec/opensearch/dsl/search/queries/term_spec.rb +66 -0
  241. data/spec/opensearch/dsl/search/queries/terms_spec.rb +55 -0
  242. data/spec/opensearch/dsl/search/queries/top_children_spec.rb +102 -0
  243. data/spec/opensearch/dsl/search/queries/wildcard_spec.rb +90 -0
  244. data/spec/spec_helper.rb +33 -0
  245. data/test/integration/search_aggregation_children_test.rb +91 -0
  246. data/test/integration/search_aggregation_geo_test.rb +111 -0
  247. data/test/integration/search_aggregation_nested_test.rb +128 -0
  248. data/test/integration/search_aggregations_test.rb +287 -0
  249. data/test/integration/search_filters_test.rb +290 -0
  250. data/test/integration/search_options_test.rb +54 -0
  251. data/test/integration/search_query_test.rb +99 -0
  252. data/test/integration/search_size_from_test.rb +71 -0
  253. data/test/integration/search_sort_test.rb +58 -0
  254. data/test/integration/search_suggest_test.rb +103 -0
  255. data/test/integration/search_test.rb +82 -0
  256. data/test/test_helper.rb +95 -0
  257. data/test/unit/dsl_test.rb +44 -0
  258. data/test/unit/search_aggregation_test.rb +98 -0
  259. data/test/unit/search_base_aggregation_component_test.rb +67 -0
  260. data/test/unit/search_base_component_test.rb +212 -0
  261. data/test/unit/search_filter_test.rb +87 -0
  262. data/test/unit/search_highlight_test.rb +103 -0
  263. data/test/unit/search_options_test.rb +114 -0
  264. data/test/unit/search_query_test.rb +91 -0
  265. data/test/unit/search_size_from_test.rb +69 -0
  266. data/test/unit/search_sort_test.rb +91 -0
  267. data/test/unit/search_suggest_test.rb +46 -0
  268. data/test/unit/search_test.rb +270 -0
  269. data/test/unit/utils_test.rb +47 -0
  270. data.tar.gz.sig +3 -0
  271. metadata +654 -0
  272. metadata.gz.sig +0 -0
@@ -0,0 +1,82 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require 'test_helper'
28
+
29
+ module OpenSearch
30
+ module Test
31
+ class SearchIntegrationTest < ::OpenSearch::Test::IntegrationTestCase
32
+ include OpenSearch::DSL::Search
33
+
34
+ class MySearch
35
+ include OpenSearch::DSL::Search
36
+
37
+ def initialize(q)
38
+ @q = q
39
+ end
40
+
41
+ def tags
42
+ %w[ one two ]
43
+ end
44
+
45
+ def search_definition
46
+ search do |q|
47
+ q.query do |q|
48
+ q.bool do |q|
49
+ q.must do |q|
50
+ q.match title: @q
51
+ end
52
+ q.must do |q|
53
+ q.terms tags: tags
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+
61
+ context "The Search class" do
62
+ setup do
63
+ @client.indices.create index: 'test'
64
+ @client.index index: 'test', id: '1', body: { title: 'Test', tags: ['one'] }
65
+ @client.index index: 'test', id: '2', body: { title: 'Test', tags: ['one', 'two'] }
66
+ @client.index index: 'test', id: '3', body: { title: 'Test', tags: ['three'] }
67
+ @client.indices.refresh index: 'test'
68
+ end
69
+
70
+
71
+ should "have access to the calling context" do
72
+ s = MySearch.new('test')
73
+ response = @client.search index: 'test', body: s.search_definition.to_hash
74
+
75
+ assert_equal 2, response['hits']['total']['value']
76
+ assert_equal 'Test', response['hits']['hits'][0]['_source']['title']
77
+ assert_same_elements ['1', '2'], response['hits']['hits'].map { |d| d['_id'] }
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,95 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ OPENSEARCH_HOSTS = if hosts = ENV['TEST_OPENSEARCH_SERVER'] || ENV['OPENSEARCH_HOSTS']
28
+ hosts.split(',').map do |host|
29
+ /(http\:\/\/)?(\S+)/.match(host)[2]
30
+ end
31
+ else
32
+ ['localhost:9200']
33
+ end.freeze
34
+
35
+ TEST_HOST, TEST_PORT = OPENSEARCH_HOSTS.first.split(':') if OPENSEARCH_HOSTS
36
+
37
+ JRUBY = defined?(JRUBY_VERSION)
38
+
39
+ if ENV['COVERAGE'] || ENV['CI']
40
+ require 'simplecov'
41
+ SimpleCov.start { add_filter "/test|test_" }
42
+ end
43
+
44
+ require 'minitest/autorun'
45
+ require 'shoulda-context'
46
+ require 'mocha/setup'
47
+
48
+ require 'opensearch'
49
+ require 'opensearch/dsl'
50
+ require 'logger'
51
+ require 'ansi'
52
+
53
+ module OpenSearch
54
+ module Test
55
+ module Assertions
56
+ def assert_nothing_raised(*)
57
+ yield
58
+ end
59
+ end
60
+
61
+ class UnitTestCase < ::Minitest::Test
62
+ include Assertions
63
+ alias_method :assert_not_nil, :refute_nil
64
+ alias_method :assert_raise, :assert_raises
65
+ end
66
+
67
+ class IntegrationTestCase < ::Minitest::Test
68
+ include Assertions
69
+ alias_method :assert_not_nil, :refute_nil
70
+ alias_method :assert_raise, :assert_raises
71
+
72
+ def setup
73
+ @port = (ENV['TEST_CLUSTER_PORT'] || 9250).to_i
74
+
75
+ @logger = Logger.new(STDERR)
76
+ @logger.formatter = proc do |severity, datetime, progname, msg|
77
+ color = case severity
78
+ when /INFO/ then :green
79
+ when /ERROR|WARN|FATAL/ then :red
80
+ when /DEBUG/ then :cyan
81
+ else :white
82
+ end
83
+ ANSI.ansi(severity[0] + ' ', color, :faint) + ANSI.ansi(msg, :white, :faint) + "\n"
84
+ end
85
+
86
+ @client = OpenSearch::Client.new(host: "#{TEST_HOST}:#{TEST_PORT}", logger: (ENV['QUIET'] ? nil : @logger))
87
+ @version = @client.info['version']['number']
88
+ end
89
+
90
+ def teardown
91
+ @client.indices.delete index: '_all'
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,44 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require 'test_helper'
28
+
29
+ module OpenSearch
30
+ module Test
31
+ class DSLTest < ::OpenSearch::Test::UnitTestCase
32
+ context "The DSL" do
33
+ class DummyDSLReceiver
34
+ include OpenSearch::DSL
35
+ end
36
+
37
+ should "include the module in receiver" do
38
+ assert_contains DummyDSLReceiver.included_modules, OpenSearch::DSL
39
+ assert_contains DummyDSLReceiver.included_modules, OpenSearch::DSL::Search
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,98 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require 'test_helper'
28
+
29
+ module OpenSearch
30
+ module Test
31
+ class SearchAggregationTest < ::OpenSearch::Test::UnitTestCase
32
+ subject { OpenSearch::DSL::Search::Aggregation.new }
33
+
34
+ context "Search Aggregation" do
35
+
36
+ should "be serializable to a Hash" do
37
+ assert_equal( {}, subject.to_hash )
38
+
39
+ subject = OpenSearch::DSL::Search::Aggregation.new
40
+ subject.instance_variable_set(:@value, { foo: 'bar' })
41
+ assert_equal( { foo: 'bar' }, subject.to_hash )
42
+ end
43
+
44
+ should "evaluate the block and return itself" do
45
+ block = Proc.new { 1+1 }
46
+ subject = OpenSearch::DSL::Search::Aggregation.new &block
47
+
48
+ subject.expects(:instance_eval)
49
+ assert_instance_of OpenSearch::DSL::Search::Aggregation, subject.call
50
+ end
51
+
52
+ should "call the block and return itself" do
53
+ block = Proc.new { |s| 1+1 }
54
+ subject = OpenSearch::DSL::Search::Aggregation.new &block
55
+
56
+ block.expects(:call)
57
+ assert_instance_of OpenSearch::DSL::Search::Aggregation, subject.call
58
+ end
59
+
60
+ should "define the value with DSL methods" do
61
+ assert_nothing_raised do
62
+ subject.terms field: 'foo'
63
+ assert_instance_of Hash, subject.to_hash
64
+ assert_equal( { terms: { field: 'foo' } }, subject.to_hash )
65
+ end
66
+ end
67
+
68
+ should "raise an exception for unknown DSL method" do
69
+ assert_raise(NoMethodError) { subject.foofoo }
70
+ end
71
+
72
+ should "return the aggregations" do
73
+ subject.expects(:call)
74
+ subject.instance_variable_set(:@value, mock(aggregations: { foo: 'bar' }))
75
+
76
+ subject.aggregations
77
+ end
78
+
79
+ should "define a nested aggregation" do
80
+ subject.instance_variable_set(:@value, mock(aggregation: true))
81
+
82
+ subject.aggregation(:foo) { 1+1 }
83
+ end
84
+
85
+ should "return a non-hashy value directly" do
86
+ subject.instance_variable_set(:@value, 'FOO')
87
+ assert_equal 'FOO', subject.to_hash
88
+ end
89
+
90
+ should "return an empty Hash when it has no value set" do
91
+ subject.instance_variable_set(:@value, nil)
92
+ assert_equal({}, subject.to_hash)
93
+ end
94
+ end
95
+
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,67 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require 'test_helper'
28
+
29
+ module OpenSearch
30
+ module Test
31
+ class BaseAggregationComponentTest < ::OpenSearch::Test::UnitTestCase
32
+ context "BaseAggregationComponent" do
33
+
34
+ class DummyAggregationComponent
35
+ include ::OpenSearch::DSL::Search::BaseAggregationComponent
36
+ end
37
+
38
+ class ::OpenSearch::DSL::Search::Aggregations::Dummy
39
+ include ::OpenSearch::DSL::Search::BaseAggregationComponent
40
+ end
41
+
42
+ subject { DummyAggregationComponent.new }
43
+
44
+ should "return an instance of the aggregation by name" do
45
+ assert_instance_of ::OpenSearch::DSL::Search::Aggregations::Dummy, subject.dummy
46
+ end
47
+
48
+ should "raise an exception when unknown aggregation is called" do
49
+ assert_raise(NoMethodError) { subject.foobar }
50
+ end
51
+
52
+ should "add a nested aggregation" do
53
+ subject.aggregation :inner do
54
+ dummy field: 'foo'
55
+ end
56
+
57
+ assert ! subject.aggregations.empty?, "#{subject.aggregations.inspect} is empty"
58
+
59
+ assert_instance_of OpenSearch::DSL::Search::Aggregation, subject.aggregations[:inner]
60
+ assert_equal( {:dummy=>{:field=>"foo"}}, subject.aggregations[:inner].to_hash )
61
+
62
+ assert_equal 'foo', subject.to_hash[:aggregations][:inner][:dummy][:field]
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,212 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require 'test_helper'
28
+
29
+ module OpenSearch
30
+ module Test
31
+ class BaseComponentTest < ::OpenSearch::Test::UnitTestCase
32
+ context "BaseComponent" do
33
+
34
+ class DummyComponent
35
+ include OpenSearch::DSL::Search::BaseComponent
36
+ end
37
+
38
+ class DummyComponentWithAName
39
+ include OpenSearch::DSL::Search::BaseComponent
40
+ name :foo
41
+ end
42
+
43
+ class DummyComponentWithNewName
44
+ include OpenSearch::DSL::Search::BaseComponent
45
+ end
46
+
47
+ class DummyCompoundFilter
48
+ include OpenSearch::DSL::Search::BaseCompoundFilterComponent
49
+ end
50
+
51
+ subject { DummyComponent.new :foo }
52
+
53
+ should "have a name" do
54
+ assert_equal :dummy_component, DummyComponent.new.name
55
+ end
56
+
57
+ should "have a custom name" do
58
+ assert_equal :foo, DummyComponentWithAName.new.name
59
+ end
60
+
61
+ should "allow to set a name" do
62
+ DummyComponentWithNewName.name :foo
63
+ assert_equal :foo, DummyComponentWithNewName.new.name
64
+ assert_equal :foo, DummyComponentWithNewName.name
65
+
66
+ DummyComponentWithNewName.name = :bar
67
+ assert_equal :bar, DummyComponentWithNewName.name
68
+ assert_equal :bar, DummyComponentWithNewName.new.name
69
+ end
70
+
71
+ should "initialize the hash" do
72
+ assert_instance_of Hash, subject.to_hash
73
+ end
74
+
75
+ should "have an empty Hash as args by default" do
76
+ subject = DummyComponentWithNewName.new
77
+ assert_equal({}, subject.instance_variable_get(:@args))
78
+ end
79
+
80
+ should "have an option method with args" do
81
+ class DummyComponentWithOptionMethod
82
+ include OpenSearch::DSL::Search::BaseComponent
83
+ option_method :bar
84
+ end
85
+
86
+ subject = DummyComponentWithOptionMethod.new :foo
87
+ assert_respond_to subject, :bar
88
+
89
+ subject.bar 'BAM'
90
+ assert_equal({ dummy_component_with_option_method: { foo: { bar: 'BAM' } } }, subject.to_hash)
91
+ end
92
+
93
+ should "keep track of option methods" do
94
+ class DummyComponentWithCustomOptionMethod
95
+ include OpenSearch::DSL::Search::BaseComponent
96
+ option_method :foo
97
+ end
98
+
99
+ subject = DummyComponentWithCustomOptionMethod
100
+ assert_includes subject.option_methods, :foo
101
+ end
102
+
103
+ should "have an option method without args" do
104
+ class DummyComponentWithOptionMethod
105
+ include OpenSearch::DSL::Search::BaseComponent
106
+ option_method :bar
107
+ end
108
+
109
+ subject = DummyComponentWithOptionMethod.new
110
+ assert_respond_to subject, :bar
111
+
112
+ subject.bar 'BAM'
113
+ assert_equal({ dummy_component_with_option_method: { bar: 'BAM' } }, subject.to_hash)
114
+ end
115
+
116
+ should "define a custom option method" do
117
+ class DummyComponentWithCustomOptionMethod
118
+ include OpenSearch::DSL::Search::BaseComponent
119
+ option_method :bar, lambda { |*args| @hash = { :foo => 'bar' } }
120
+ end
121
+
122
+ subject = DummyComponentWithCustomOptionMethod.new
123
+ subject.bar
124
+
125
+ assert_equal 'bar', subject.instance_variable_get(:@hash)[:foo]
126
+ end
127
+
128
+ should "execute the passed block" do
129
+ subject = DummyComponent.new(:foo) { @foo = 'BAR' }
130
+
131
+ assert_respond_to subject, :call
132
+ assert_instance_of DummyComponent, subject.call
133
+ assert_equal 'BAR', subject.instance_variable_get(:@foo)
134
+ end
135
+
136
+ should "respond to empty?" do
137
+ assert DummyComponent.new.empty?
138
+ assert DummyComponent.new(:foo).empty?
139
+
140
+ subject = DummyComponent.new(:foo) { @hash = { foo: 'bar' } }
141
+ assert ! subject.empty?
142
+ end
143
+
144
+ context "to_hash conversion" do
145
+
146
+ should "build the hash with the block with args" do
147
+ subject = DummyComponent.new :foo do
148
+ @hash[:dummy_component][:foo].update moo: 'xoo'
149
+ end
150
+
151
+ assert_equal({dummy_component: { foo: { moo: 'xoo' } } }, subject.to_hash )
152
+ end
153
+
154
+ should "build the hash with the block without args" do
155
+ subject = DummyComponent.new do
156
+ @hash[:dummy_component].update moo: 'xoo'
157
+ end
158
+
159
+ assert_equal({dummy_component: { moo: 'xoo' } }, subject.to_hash )
160
+ end
161
+
162
+ should "build the hash with the option method" do
163
+ class DummyComponentWithOptionMethod
164
+ include OpenSearch::DSL::Search::BaseComponent
165
+ option_method :foo
166
+ end
167
+
168
+ subject = DummyComponentWithOptionMethod.new do
169
+ foo 'bar'
170
+ end
171
+
172
+ assert_equal({ dummy_component_with_option_method: { foo: 'bar' } }, subject.to_hash)
173
+ end
174
+
175
+ should "build the hash with the passed args" do
176
+ subject = DummyComponent.new foo: 'bar'
177
+
178
+ assert_equal({ dummy_component: { foo: 'bar' } }, subject.to_hash)
179
+ end
180
+
181
+ should "merge the top-level options to the hash" do
182
+ class DummyComponentWithOptionMethod
183
+ include OpenSearch::DSL::Search::BaseComponent
184
+ option_method :bar
185
+ end
186
+
187
+ subject = DummyComponentWithOptionMethod.new :foo, xoo: 'X' do
188
+ bar 'B'
189
+ end
190
+
191
+ assert_equal({ dummy_component_with_option_method: { xoo: 'X', foo: { bar: 'B' } } }, subject.to_hash)
192
+ end
193
+
194
+ should "return the already built hash" do
195
+ subject = DummyComponent.new
196
+ subject.instance_variable_set(:@hash, { foo: 'bar' })
197
+
198
+ assert_equal({ foo: 'bar' }, subject.to_hash)
199
+ end
200
+ end
201
+
202
+ context "compound filter" do
203
+ subject { DummyCompoundFilter.new }
204
+
205
+ should "raise an exception for unknown DSL method" do
206
+ assert_raise(NoMethodError) { subject.foofoo }
207
+ end
208
+ end
209
+ end
210
+ end
211
+ end
212
+ end
@@ -0,0 +1,87 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ #
3
+ # The OpenSearch Contributors require contributions made to
4
+ # this file be licensed under the Apache-2.0 license or a
5
+ # compatible open source license.
6
+ #
7
+ # Modifications Copyright OpenSearch Contributors. See
8
+ # GitHub history for details.
9
+ #
10
+ # Licensed to Elasticsearch B.V. under one or more contributor
11
+ # license agreements. See the NOTICE file distributed with
12
+ # this work for additional information regarding copyright
13
+ # ownership. Elasticsearch B.V. licenses this file to you under
14
+ # the Apache License, Version 2.0 (the "License"); you may
15
+ # not use this file except in compliance with the License.
16
+ # You may obtain a copy of the License at
17
+ #
18
+ # http://www.apache.org/licenses/LICENSE-2.0
19
+ #
20
+ # Unless required by applicable law or agreed to in writing,
21
+ # software distributed under the License is distributed on an
22
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
23
+ # KIND, either express or implied. See the License for the
24
+ # specific language governing permissions and limitations
25
+ # under the License.
26
+
27
+ require 'test_helper'
28
+
29
+ module OpenSearch
30
+ module Test
31
+ class SearchFilterTest < ::OpenSearch::Test::UnitTestCase
32
+ subject { OpenSearch::DSL::Search::Filter.new }
33
+
34
+ context "Search Filter" do
35
+
36
+ should "be serializable to a Hash" do
37
+ assert_equal( {}, subject.to_hash )
38
+
39
+ subject = OpenSearch::DSL::Search::Filter.new
40
+ subject.instance_variable_set(:@value, { foo: 'bar' })
41
+ assert_equal( { foo: 'bar' }, subject.to_hash )
42
+ end
43
+
44
+ should "evaluate the block and return itself" do
45
+ block = Proc.new { 1+1 }
46
+ subject = OpenSearch::DSL::Search::Filter.new &block
47
+
48
+ subject.expects(:instance_eval)
49
+ assert_instance_of OpenSearch::DSL::Search::Filter, subject.call
50
+ end
51
+
52
+ should "call the block and return itself" do
53
+ block = Proc.new { |s| 1+1 }
54
+ subject = OpenSearch::DSL::Search::Filter.new &block
55
+
56
+ block.expects(:call)
57
+ assert_instance_of OpenSearch::DSL::Search::Filter, subject.call
58
+ end
59
+
60
+ should "define the value with filter methods" do
61
+ assert_nothing_raised do
62
+ subject.term foo: 'bar'
63
+ assert_instance_of Hash, subject.to_hash
64
+ assert_equal( { term: { foo: 'bar' } }, subject.to_hash )
65
+ end
66
+ end
67
+
68
+ should "redefine the value with filter methods" do
69
+ assert_nothing_raised do
70
+ subject.term foo: 'bar'
71
+ subject.term foo: 'bam'
72
+ subject.to_hash
73
+ subject.to_hash
74
+ assert_instance_of Hash, subject.to_hash
75
+ assert_equal({ term: { foo: 'bam' } }, subject.to_hash)
76
+ end
77
+ end
78
+
79
+ should "raise an exception for unknown filter" do
80
+ assert_raise(NoMethodError) { subject.foofoo }
81
+ end
82
+
83
+ end
84
+
85
+ end
86
+ end
87
+ end