Skip to content

Commit c85e862

Browse files
committed
Method assert_sql changed to assert_queries_match
See rails/rails#50373
1 parent 3f03e48 commit c85e862

6 files changed

+61
-61
lines changed

test/cases/active_schema_test_sqlserver.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,38 @@ class ActiveSchemaTestSQLServer < ActiveRecord::TestCase
1616
end
1717

1818
it 'default index' do
19-
assert_sql('CREATE INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
19+
assert_queries_match('CREATE INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
2020
connection.add_index :schema_test_table, "foo"
2121
end
2222
end
2323

2424
it 'unique index' do
25-
assert_sql('CREATE UNIQUE INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
25+
assert_queries_match('CREATE UNIQUE INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
2626
connection.add_index :schema_test_table, "foo", unique: true
2727
end
2828
end
2929

3030
it 'where condition on index' do
31-
assert_sql("CREATE INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo]) WHERE state = 'active'") do
31+
assert_queries_match("CREATE INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo]) WHERE state = 'active'") do
3232
connection.add_index :schema_test_table, "foo", where: "state = 'active'"
3333
end
3434
end
3535

3636
it 'if index does not exist' do
37-
assert_sql("IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'index_schema_test_table_on_foo') " \
37+
assert_queries_match("IF NOT EXISTS (SELECT name FROM sysindexes WHERE name = 'index_schema_test_table_on_foo') " \
3838
"CREATE INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])") do
3939
connection.add_index :schema_test_table, "foo", if_not_exists: true
4040
end
4141
end
4242

4343
it 'clustered index' do
44-
assert_sql('CREATE CLUSTERED INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
44+
assert_queries_match('CREATE CLUSTERED INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
4545
connection.add_index :schema_test_table, "foo", type: :clustered
4646
end
4747
end
4848

4949
it 'nonclustered index' do
50-
assert_sql('CREATE NONCLUSTERED INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
50+
assert_queries_match('CREATE NONCLUSTERED INDEX [index_schema_test_table_on_foo] ON [schema_test_table] ([foo])') do
5151
connection.add_index :schema_test_table, "foo", type: :nonclustered
5252
end
5353
end

test/cases/coerced_tests.rb

+34-34
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def test_belongs_to_with_primary_key_joins_on_correct_column_coerced
260260
def test_belongs_to_coerced
261261
client = Client.find(3)
262262
first_firm = companies(:first_firm)
263-
assert_sql(/FETCH NEXT @(\d) ROWS ONLY(.)*@\1 = 1/) do
263+
assert_queries_match(/FETCH NEXT @(\d) ROWS ONLY(.)*@\1 = 1/) do
264264
assert_equal first_firm, client.firm
265265
assert_equal first_firm.name, client.firm.name
266266
end
@@ -323,7 +323,7 @@ def assert_bind_params_to_sql_coerced(prepared:)
323323

324324
authors = Author.where(id: [1, 2, 3, nil])
325325
assert_equal sql_unprepared, @connection.to_sql(authors.arel)
326-
assert_sql(prepared ? sql_prepared : sql_unprepared) { assert_equal 3, authors.length }
326+
assert_queries_match(prepared ? sql_prepared : sql_unprepared) { assert_equal 3, authors.length }
327327

328328
# prepared_statements: true
329329
#
@@ -338,7 +338,7 @@ def assert_bind_params_to_sql_coerced(prepared:)
338338

339339
authors = Author.where(id: [1, 2, 3, 9223372036854775808])
340340
assert_equal sql_unprepared, @connection.to_sql(authors.arel)
341-
assert_sql(prepared ? sql_prepared : sql_unprepared) { assert_equal 3, authors.length }
341+
assert_queries_match(prepared ? sql_prepared : sql_unprepared) { assert_equal 3, authors.length }
342342
end
343343
end
344344
end
@@ -947,9 +947,9 @@ class FinderTest < ActiveRecord::TestCase
947947
# Assert SQL Server limit implementation
948948
coerce_tests! :test_take_and_first_and_last_with_integer_should_use_sql_limit
949949
def test_take_and_first_and_last_with_integer_should_use_sql_limit_coerced
950-
assert_sql(/OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.* @0 = 3/) { Topic.take(3).entries }
951-
assert_sql(/OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.* @0 = 2/) { Topic.first(2).entries }
952-
assert_sql(/OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.* @0 = 5/) { Topic.last(5).entries }
950+
assert_queries_match(/OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.* @0 = 3/) { Topic.take(3).entries }
951+
assert_queries_match(/OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.* @0 = 2/) { Topic.first(2).entries }
952+
assert_queries_match(/OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.* @0 = 5/) { Topic.last(5).entries }
953953
end
954954

955955
# This fails only when run in the full test suite task. Just taking it out of the mix.
@@ -980,31 +980,31 @@ def test_condition_local_time_interpolation_with_default_timezone_utc_coerced
980980
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
981981
coerce_tests! :test_include_on_unloaded_relation_with_match
982982
def test_include_on_unloaded_relation_with_match_coerced
983-
assert_sql(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
983+
assert_queries_match(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
984984
assert_equal true, Customer.where(name: "David").include?(customers(:david))
985985
end
986986
end
987987

988988
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
989989
coerce_tests! :test_include_on_unloaded_relation_without_match
990990
def test_include_on_unloaded_relation_without_match_coerced
991-
assert_sql(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
991+
assert_queries_match(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
992992
assert_equal false, Customer.where(name: "David").include?(customers(:mary))
993993
end
994994
end
995995

996996
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
997997
coerce_tests! :test_member_on_unloaded_relation_with_match
998998
def test_member_on_unloaded_relation_with_match_coerced
999-
assert_sql(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
999+
assert_queries_match(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
10001000
assert_equal true, Customer.where(name: "David").member?(customers(:david))
10011001
end
10021002
end
10031003

10041004
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
10051005
coerce_tests! :test_member_on_unloaded_relation_without_match
10061006
def test_member_on_unloaded_relation_without_match_coerced
1007-
assert_sql(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
1007+
assert_queries_match(/1 AS one.*FETCH NEXT @2 ROWS ONLY.*@2 = 1/) do
10081008
assert_equal false, Customer.where(name: "David").member?(customers(:mary))
10091009
end
10101010
end
@@ -1019,7 +1019,7 @@ def test_implicit_order_column_is_configurable_coerced
10191019
assert_equal topics(:third), Topic.last
10201020

10211021
c = Topic.lease_connection
1022-
assert_sql(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.title"))} DESC, #{Regexp.escape(c.quote_table_name("topics.id"))} DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i) {
1022+
assert_queries_match(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.title"))} DESC, #{Regexp.escape(c.quote_table_name("topics.id"))} DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i) {
10231023
Topic.last
10241024
}
10251025
ensure
@@ -1033,7 +1033,7 @@ def test_implicit_order_set_to_primary_key_coerced
10331033
Topic.implicit_order_column = "id"
10341034

10351035
c = Topic.lease_connection
1036-
assert_sql(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.id"))} DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i) {
1036+
assert_queries_match(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.id"))} DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i) {
10371037
Topic.last
10381038
}
10391039
ensure
@@ -1048,7 +1048,7 @@ def test_implicit_order_for_model_without_primary_key_coerced
10481048

10491049
c = NonPrimaryKey.lease_connection
10501050

1051-
assert_sql(/ORDER BY #{Regexp.escape(c.quote_table_name("non_primary_keys.created_at"))} DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i) {
1051+
assert_queries_match(/ORDER BY #{Regexp.escape(c.quote_table_name("non_primary_keys.created_at"))} DESC OFFSET 0 ROWS FETCH NEXT @0 ROWS ONLY.*@0 = 1/i) {
10521052
NonPrimaryKey.last
10531053
}
10541054
ensure
@@ -1058,7 +1058,7 @@ def test_implicit_order_for_model_without_primary_key_coerced
10581058
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
10591059
coerce_tests! :test_member_on_unloaded_relation_with_composite_primary_key
10601060
def test_member_on_unloaded_relation_with_composite_primary_key_coerced
1061-
assert_sql(/1 AS one.* FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/) do
1061+
assert_queries_match(/1 AS one.* FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/) do
10621062
book = cpk_books(:cpk_great_author_first_book)
10631063
assert Cpk::Book.where(title: "The first book").member?(book)
10641064
end
@@ -1073,7 +1073,7 @@ def test_implicit_order_column_prepends_query_constraints_coerced
10731073
quoted_color = Regexp.escape(c.quote_table_name("clothing_items.color"))
10741074
quoted_descrption = Regexp.escape(c.quote_table_name("clothing_items.description"))
10751075

1076-
assert_sql(/ORDER BY #{quoted_descrption} ASC, #{quoted_type} ASC, #{quoted_color} ASC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
1076+
assert_queries_match(/ORDER BY #{quoted_descrption} ASC, #{quoted_type} ASC, #{quoted_color} ASC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
10771077
assert_kind_of ClothingItem, ClothingItem.first
10781078
end
10791079
ensure
@@ -1087,7 +1087,7 @@ def test_implicit_order_column_prepends_query_constraints_coerced
10871087
quoted_type = Regexp.escape(c.quote_table_name("clothing_items.clothing_type"))
10881088
quoted_color = Regexp.escape(c.quote_table_name("clothing_items.color"))
10891089

1090-
assert_sql(/ORDER BY #{quoted_type} DESC, #{quoted_color} DESC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
1090+
assert_queries_match(/ORDER BY #{quoted_type} DESC, #{quoted_color} DESC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
10911091
assert_kind_of ClothingItem, ClothingItem.last
10921092
end
10931093
end
@@ -1099,7 +1099,7 @@ def test_implicit_order_column_prepends_query_constraints_coerced
10991099
quoted_type = Regexp.escape(c.quote_table_name("clothing_items.clothing_type"))
11001100
quoted_color = Regexp.escape(c.quote_table_name("clothing_items.color"))
11011101

1102-
assert_sql(/ORDER BY #{quoted_type} ASC, #{quoted_color} ASC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
1102+
assert_queries_match(/ORDER BY #{quoted_type} ASC, #{quoted_color} ASC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
11031103
assert_kind_of ClothingItem, ClothingItem.first
11041104
end
11051105
end
@@ -1112,7 +1112,7 @@ def test_implicit_order_column_reorders_query_constraints_coerced
11121112
quoted_type = Regexp.escape(c.quote_table_name("clothing_items.clothing_type"))
11131113
quoted_color = Regexp.escape(c.quote_table_name("clothing_items.color"))
11141114

1115-
assert_sql(/ORDER BY #{quoted_color} ASC, #{quoted_type} ASC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
1115+
assert_queries_match(/ORDER BY #{quoted_color} ASC, #{quoted_type} ASC OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/i) do
11161116
assert_kind_of ClothingItem, ClothingItem.first
11171117
end
11181118
ensure
@@ -1122,7 +1122,7 @@ def test_implicit_order_column_reorders_query_constraints_coerced
11221122
# Check for `FETCH NEXT x ROWS` rather then `LIMIT`.
11231123
coerce_tests! :test_include_on_unloaded_relation_with_composite_primary_key
11241124
def test_include_on_unloaded_relation_with_composite_primary_key_coerced
1125-
assert_sql(/1 AS one.*OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/) do
1125+
assert_queries_match(/1 AS one.*OFFSET 0 ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1/) do
11261126
book = cpk_books(:cpk_great_author_first_book)
11271127
assert Cpk::Book.where(title: "The first book").include?(book)
11281128
end
@@ -1132,11 +1132,11 @@ def test_include_on_unloaded_relation_with_composite_primary_key_coerced
11321132
coerce_tests! :test_nth_to_last_with_order_uses_limit
11331133
def test_nth_to_last_with_order_uses_limit_coerced
11341134
c = Topic.lease_connection
1135-
assert_sql(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.id"))} DESC OFFSET @(\d) ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1.*@\2 = 1/i) do
1135+
assert_queries_match(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.id"))} DESC OFFSET @(\d) ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1.*@\2 = 1/i) do
11361136
Topic.second_to_last
11371137
end
11381138

1139-
assert_sql(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.updated_at"))} DESC OFFSET @(\d) ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1.*@\2 = 1/i) do
1139+
assert_queries_match(/ORDER BY #{Regexp.escape(c.quote_table_name("topics.updated_at"))} DESC OFFSET @(\d) ROWS FETCH NEXT @(\d) ROWS ONLY.*@\1 = 1.*@\2 = 1/i) do
11401140
Topic.order(:updated_at).second_to_last
11411141
end
11421142
end
@@ -1184,7 +1184,7 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
11841184
def test_has_one_coerced
11851185
firm = companies(:first_firm)
11861186
first_account = Account.find(1)
1187-
assert_sql(/FETCH NEXT @(\d) ROWS ONLY(.)*@\1 = 1/) do
1187+
assert_queries_match(/FETCH NEXT @(\d) ROWS ONLY(.)*@\1 = 1/) do
11881188
assert_equal first_account, firm.account
11891189
assert_equal first_account.credit_limit, firm.account.credit_limit
11901190
end
@@ -1196,7 +1196,7 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase
11961196
coerce_tests! :test_has_one_through_executes_limited_query
11971197
def test_has_one_through_executes_limited_query_coerced
11981198
boring_club = clubs(:boring_club)
1199-
assert_sql(/FETCH NEXT @(\d) ROWS ONLY(.)*@\1 = 1/) do
1199+
assert_queries_match(/FETCH NEXT @(\d) ROWS ONLY(.)*@\1 = 1/) do
12001200
assert_equal boring_club, @member.general_club
12011201
end
12021202
end
@@ -1257,7 +1257,7 @@ def test_update_all_doesnt_ignore_order_coerced
12571257
_(david.id).must_equal 1
12581258
_(mary.id).must_equal 2
12591259
_(david.name).wont_equal mary.name
1260-
assert_sql(/UPDATE.*\(SELECT \[authors\].\[id\] FROM \[authors\].*ORDER BY \[authors\].\[id\]/i) do
1260+
assert_queries_match(/UPDATE.*\(SELECT \[authors\].\[id\] FROM \[authors\].*ORDER BY \[authors\].\[id\]/i) do
12611261
Author.where("[id] > 1").order(:id).update_all(name: "Test")
12621262
end
12631263
_(david.reload.name).must_equal "David"
@@ -1436,15 +1436,15 @@ def test_having_with_binds_for_both_where_and_having
14361436
# Find any limit via our expression.
14371437
coerce_tests! %r{relations don't load all records in #inspect}
14381438
def test_relations_dont_load_all_records_in_inspect_coerced
1439-
assert_sql(/NEXT @0 ROWS.*@0 = \d+/) do
1439+
assert_queries_match(/NEXT @0 ROWS.*@0 = \d+/) do
14401440
Post.all.inspect
14411441
end
14421442
end
14431443

14441444
# Find any limit via our expression.
14451445
coerce_tests! %r{relations don't load all records in #pretty_print}
14461446
def test_relations_dont_load_all_records_in_pretty_print_coerced
1447-
assert_sql(/FETCH NEXT @(\d) ROWS ONLY/) do
1447+
assert_queries_match(/FETCH NEXT @(\d) ROWS ONLY/) do
14481448
PP.pp Post.all, StringIO.new # avoid outputting.
14491449
end
14501450
end
@@ -1516,11 +1516,11 @@ def self.search_as_method(term)
15161516
}
15171517
end
15181518

1519-
assert_sql(/LIKE N'20!% !_reduction!_!!'/) do
1519+
assert_queries_match(/LIKE N'20!% !_reduction!_!!'/) do
15201520
searchable_post.search_as_method("20% _reduction_!").to_a
15211521
end
15221522

1523-
assert_sql(/LIKE N'20!% !_reduction!_!!'/) do
1523+
assert_queries_match(/LIKE N'20!% !_reduction!_!!'/) do
15241524
searchable_post.search_as_scope("20% _reduction_!").to_a
15251525
end
15261526
end
@@ -2125,13 +2125,13 @@ def test_merge_doesnt_duplicate_same_clauses_coerced
21252125
non_mary_and_bob = Author.where.not(id: [mary, bob])
21262126

21272127
author_id = Author.connection.quote_table_name("authors.id")
2128-
assert_sql(/WHERE #{Regexp.escape(author_id)} NOT IN \((@\d), \g<1>\)'/) do
2128+
assert_queries_match(/WHERE #{Regexp.escape(author_id)} NOT IN \((@\d), \g<1>\)'/) do
21292129
assert_equal [david], non_mary_and_bob.merge(non_mary_and_bob)
21302130
end
21312131

21322132
only_david = Author.where("#{author_id} IN (?)", david)
21332133

2134-
assert_sql(/WHERE \(#{Regexp.escape(author_id)} IN \(1\)\)\z/) do
2134+
assert_queries_match(/WHERE \(#{Regexp.escape(author_id)} IN \(1\)\)\z/) do
21352135
assert_equal [david], only_david.merge(only_david)
21362136
end
21372137
end
@@ -2253,7 +2253,7 @@ def test_eager_loading_too_many_ids_coerced
22532253

22542254
# Perform test
22552255
citation_count = Citation.count
2256-
assert_sql(/WHERE \[citations\]\.\[id\] IN \(0, 1/) do
2256+
assert_queries_match(/WHERE \[citations\]\.\[id\] IN \(0, 1/) do
22572257
assert_equal citation_count, Citation.eager_load(:citations).offset(0).size
22582258
end
22592259
end
@@ -2449,7 +2449,7 @@ class QueryLogsTest < ActiveRecord::TestCase
24492449
coerce_tests! :test_sql_commenter_format
24502450
def test_sql_commenter_format_coerced
24512451
ActiveRecord::QueryLogs.update_formatter(:sqlcommenter)
2452-
assert_sql(%r{/\*application=''active_record''\*/}) do
2452+
assert_queries_match(%r{/\*application=''active_record''\*/}) do
24532453
Dashboard.first
24542454
end
24552455
end
@@ -2464,7 +2464,7 @@ def test_sqlcommenter_format_value_coerced
24642464
{ tracestate: "congo=t61rcWkgMzE,rojo=00f067aa0ba902b7", custom_proc: -> { "Joe's Shack" } },
24652465
]
24662466

2467-
assert_sql(%r{custom_proc=''Joe%27s%20Shack'',tracestate=''congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7''\*/}) do
2467+
assert_queries_match(%r{custom_proc=''Joe%27s%20Shack'',tracestate=''congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7''\*/}) do
24682468
Dashboard.first
24692469
end
24702470
end
@@ -2479,7 +2479,7 @@ def test_sqlcommenter_format_value_string_coercible_coerced
24792479
{ custom_proc: -> { 1234 } },
24802480
]
24812481

2482-
assert_sql(%r{custom_proc=''1234''\*/}) do
2482+
assert_queries_match(%r{custom_proc=''1234''\*/}) do
24832483
Dashboard.first
24842484
end
24852485
end

test/cases/index_test_sqlserver.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ class IndexTestSQLServer < ActiveRecord::TestCase
1919
end
2020

2121
it "add index with order" do
22-
assert_sql(/CREATE.*INDEX.*\(\[last_name\] DESC\)/i) do
22+
assert_queries_match(/CREATE.*INDEX.*\(\[last_name\] DESC\)/i) do
2323
connection.add_index "testings", ["last_name"], order: { last_name: :desc }
2424
connection.remove_index "testings", ["last_name"]
2525
end
26-
assert_sql(/CREATE.*INDEX.*\(\[last_name\] DESC, \[first_name\]\)/i) do
26+
assert_queries_match(/CREATE.*INDEX.*\(\[last_name\] DESC, \[first_name\]\)/i) do
2727
connection.add_index "testings", ["last_name", "first_name"], order: { last_name: :desc }
2828
connection.remove_index "testings", ["last_name", "first_name"]
2929
end
30-
assert_sql(/CREATE.*INDEX.*\(\[last_name\] DESC, \[first_name\] ASC\)/i) do
30+
assert_queries_match(/CREATE.*INDEX.*\(\[last_name\] DESC, \[first_name\] ASC\)/i) do
3131
connection.add_index "testings", ["last_name", "first_name"], order: { last_name: :desc, first_name: :asc }
3232
connection.remove_index "testings", ["last_name", "first_name"]
3333
end
3434
end
3535

3636
it "add index with where" do
37-
assert_sql(/CREATE.*INDEX.*\(\[last_name\]\) WHERE \[first_name\] = N'john doe'/i) do
37+
assert_queries_match(/CREATE.*INDEX.*\(\[last_name\]\) WHERE \[first_name\] = N'john doe'/i) do
3838
connection.add_index "testings", "last_name", where: "[first_name] = N'john doe'"
3939
connection.remove_index "testings", "last_name"
4040
end

0 commit comments

Comments
 (0)