Skip to content

Commit 9e2117b

Browse files
committed
Fix EXPLAIN tests
See rails/rails#50482
1 parent bba549f commit 9e2117b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/cases/showplan_test_sqlserver.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,32 @@ class ShowplanTestSQLServer < ActiveRecord::TestCase
88

99
describe "Unprepare previously prepared SQL" do
1010
it "from simple statement" do
11-
plan = Car.where(id: 1).explain
11+
plan = Car.where(id: 1).explain.inspect
1212
_(plan).must_include "SELECT [cars].* FROM [cars] WHERE [cars].[id] = 1"
1313
_(plan).must_include "Clustered Index Seek", "make sure we do not showplan the sp_executesql"
1414
end
1515

1616
it "from multiline statement" do
17-
plan = Car.where("\n id = 1 \n").explain
17+
plan = Car.where("\n id = 1 \n").explain.inspect
1818
_(plan).must_include "SELECT [cars].* FROM [cars] WHERE (\n id = 1 \n)"
1919
_(plan).must_include "Clustered Index Seek", "make sure we do not showplan the sp_executesql"
2020
end
2121

2222
it "from prepared statement" do
23-
plan = Car.where(name: ",").limit(1).explain
23+
plan = Car.where(name: ",").limit(1).explain.inspect
2424
_(plan).must_include "SELECT [cars].* FROM [cars] WHERE [cars].[name]"
2525
_(plan).must_include "TOP EXPRESSION", "make sure we do not showplan the sp_executesql"
2626
_(plan).must_include "Clustered Index Scan", "make sure we do not showplan the sp_executesql"
2727
end
2828

2929
it "from array condition using index" do
30-
plan = Car.where(id: [1, 2]).explain
30+
plan = Car.where(id: [1, 2]).explain.inspect
3131
_(plan).must_include "SELECT [cars].* FROM [cars] WHERE [cars].[id] IN (1, 2)"
3232
_(plan).must_include "Clustered Index Seek", "make sure we do not showplan the sp_executesql"
3333
end
3434

3535
it "from array condition" do
36-
plan = Car.where(name: ["honda", "zyke"]).explain
36+
plan = Car.where(name: ["honda", "zyke"]).explain.inspect
3737
_(plan).must_include " SELECT [cars].* FROM [cars] WHERE [cars].[name] IN (N'honda', N'zyke')"
3838
_(plan).must_include "Clustered Index Scan", "make sure we do not showplan the sp_executesql"
3939
end
@@ -42,7 +42,7 @@ class ShowplanTestSQLServer < ActiveRecord::TestCase
4242
describe "With SHOWPLAN_TEXT option" do
4343
it "use simple table printer" do
4444
with_showplan_option("SHOWPLAN_TEXT") do
45-
plan = Car.where(id: 1).explain
45+
plan = Car.where(id: 1).explain.inspect
4646
_(plan).must_include "SELECT [cars].* FROM [cars] WHERE [cars].[id]"
4747
_(plan).must_include "Clustered Index Seek", "make sure we do not showplan the sp_executesql"
4848
end
@@ -52,7 +52,7 @@ class ShowplanTestSQLServer < ActiveRecord::TestCase
5252
describe "With SHOWPLAN_XML option" do
5353
it "show formatted xml" do
5454
with_showplan_option("SHOWPLAN_XML") do
55-
plan = Car.where(id: 1).explain
55+
plan = Car.where(id: 1).explain.inspect
5656
_(plan).must_include "ShowPlanXML"
5757
end
5858
end

0 commit comments

Comments
 (0)