@@ -31,7 +31,7 @@ def test_matching_with_filters
3131 AND "products"."rating" >= 4
3232 SQL
3333
34- assert_equal expected , sql
34+ assert_sql_equal expected , sql
3535 end
3636
3737 def test_chain_multiple_search_fields_and
@@ -44,12 +44,12 @@ def test_chain_multiple_search_fields_and
4444 WHERE ("products"."description" &&& 'running shoes' AND "products"."category" ### 'Footwear')
4545 SQL
4646
47- assert_equal expected , sql
47+ assert_sql_equal expected , sql
4848 end
4949
5050 def test_match_any_or_semantics
5151 sql = Product . search ( :description ) . matching ( any : [ "wireless" , "bluetooth" ] ) . to_sql
52- assert_equal %(SELECT * FROM products\n WHERE "products"."description" ||| 'wireless bluetooth') , sql
52+ assert_sql_equal %(SELECT * FROM products WHERE "products"."description" ||| 'wireless bluetooth') , sql
5353 end
5454
5555 def test_excluding_terms
@@ -63,42 +63,42 @@ def test_excluding_terms
6363 WHERE ("products"."description" &&& 'shoes' AND NOT ("products"."description" &&& 'cheap budget'))
6464 SQL
6565
66- assert_equal expected , sql
66+ assert_sql_equal expected , sql
6767 end
6868
6969 def test_phrase_with_slop
7070 sql = Product . search ( :description ) . phrase ( "running shoes" , slop : 2 ) . to_sql
71- assert_equal %(SELECT * FROM products\n WHERE "products"."description" ### 'running shoes'::pdb.slop(2)) , sql
71+ assert_sql_equal %(SELECT * FROM products WHERE "products"."description" ### 'running shoes'::pdb.slop(2)) , sql
7272 end
7373
7474 def test_fuzzy_with_prefix
7575 sql = Product . search ( :description ) . fuzzy ( "runn" , distance : 1 , prefix : true ) . to_sql
76- assert_equal %(SELECT * FROM products\n WHERE "products"."description" === 'runn'::pdb.fuzzy(1, "true")) , sql
76+ assert_sql_equal %(SELECT * FROM products WHERE "products"."description" === 'runn'::pdb.fuzzy(1, "true")) , sql
7777 end
7878
7979 def test_regex
8080 sql = Product . search ( :description ) . regex ( "run.*shoes" ) . to_sql
81- assert_equal %(SELECT * FROM products\n WHERE "products"."description" @@@ pdb.regex('run.*shoes')) , sql
81+ assert_sql_equal %(SELECT * FROM products WHERE "products"."description" @@@ pdb.regex('run.*shoes')) , sql
8282 end
8383
8484 def test_term_exact
8585 sql = Product . search ( :description ) . term ( "shoes" ) . to_sql
86- assert_equal %(SELECT * FROM products\n WHERE "products"."description" === 'shoes') , sql
86+ assert_sql_equal %(SELECT * FROM products WHERE "products"."description" === 'shoes') , sql
8787 end
8888
8989 def test_near_proximity
9090 sql = Product . search ( :description ) . near ( "sleek" , "shoes" , distance : 1 ) . to_sql
91- assert_equal %(SELECT * FROM products\n WHERE "products"."description" @@@ ('sleek' ## 1 ## 'shoes')) , sql
91+ assert_sql_equal %(SELECT * FROM products WHERE "products"."description" @@@ ('sleek' ## 1 ## 'shoes')) , sql
9292 end
9393
9494 def test_phrase_prefix
9595 sql = Product . search ( :description ) . phrase_prefix ( "run" , "sh" ) . to_sql
96- assert_equal %(SELECT * FROM products\n WHERE "products"."description" @@@ pdb.phrase_prefix(ARRAY['run', 'sh'])) , sql
96+ assert_sql_equal %(SELECT * FROM products WHERE "products"."description" @@@ pdb.phrase_prefix(ARRAY['run', 'sh'])) , sql
9797 end
9898
9999 def test_similar_to
100100 sql = Product . similar_to ( 3 , fields : [ :description ] ) . to_sql
101- assert_equal %(SELECT * FROM products\n WHERE "products"."id" @@@ pdb.more_like_this(3, ARRAY['description'])) , sql
101+ assert_sql_equal %(SELECT * FROM products WHERE "products"."id" @@@ pdb.more_like_this(3, ARRAY['description'])) , sql
102102 end
103103
104104 def test_with_score_and_order
@@ -114,7 +114,7 @@ def test_with_score_and_order
114114 ORDER BY search_score DESC
115115 SQL
116116
117- assert_equal expected , sql
117+ assert_sql_equal expected , sql
118118 end
119119
120120 def test_with_snippet_default
@@ -128,7 +128,7 @@ def test_with_snippet_default
128128 WHERE "products"."description" &&& 'running shoes'
129129 SQL
130130
131- assert_equal expected , sql
131+ assert_sql_equal expected , sql
132132 end
133133
134134 def test_with_snippet_custom
@@ -142,7 +142,7 @@ def test_with_snippet_custom
142142 WHERE "products"."description" &&& 'running shoes'
143143 SQL
144144
145- assert_equal expected , sql
145+ assert_sql_equal expected , sql
146146 end
147147
148148 def test_or_across_fields
@@ -156,7 +156,7 @@ def test_or_across_fields
156156 WHERE (("products"."description" &&& 'shoes') OR ("products"."category" &&& 'footwear'))
157157 SQL
158158
159- assert_equal expected , sql
159+ assert_sql_equal expected , sql
160160 end
161161
162162 def test_facets_only
@@ -172,7 +172,7 @@ def test_facets_only
172172 WHERE "products"."description" &&& 'shoes'
173173 SQL
174174
175- assert_equal expected , facet_sql
175+ assert_sql_equal expected , facet_sql
176176 end
177177
178178 def test_with_facets_rows_plus_facets
@@ -190,6 +190,6 @@ def test_with_facets_rows_plus_facets
190190 LIMIT 10
191191 SQL
192192
193- assert_equal expected , sql
193+ assert_sql_equal expected , sql
194194 end
195195end
0 commit comments