Skip to content

Commit 2b37260

Browse files
committed
Fix for RuboCop
1 parent 0cd2e33 commit 2b37260

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

spec/mysql2/client_spec.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,14 +1071,16 @@ def run_gc
10711071
end
10721072

10731073
it "#affected_rows with multi statements returns the last result's affected_rows" do
1074-
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_ON)
1075-
1076-
@client.query("INSERT INTO lastIdTest (blah) VALUES (1234), (5678); UPDATE lastIdTest SET blah=4321 WHERE id=1")
1077-
expect(@client.affected_rows).to eq(2)
1078-
expect(@client.next_result).to eq(true)
1079-
expect(@client.affected_rows).to eq(1)
1080-
ensure
1081-
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_OFF)
1074+
begin
1075+
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_ON)
1076+
1077+
@client.query("INSERT INTO lastIdTest (blah) VALUES (1234), (5678); UPDATE lastIdTest SET blah=4321 WHERE id=1")
1078+
expect(@client.affected_rows).to eq(2)
1079+
expect(@client.next_result).to eq(true)
1080+
expect(@client.affected_rows).to eq(1)
1081+
ensure
1082+
@client.set_server_option(Mysql2::Client::OPTION_MULTI_STATEMENTS_OFF)
1083+
end
10821084
end
10831085

10841086
it "#affected_rows isn't cleared by Statement#close" do

0 commit comments

Comments
 (0)