Skip to content

Commit 770ec66

Browse files
authored
Rubocop updates in specs (#1434)
1 parent b009d7e commit 770ec66

2 files changed

Lines changed: 13 additions & 11 deletions

File tree

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

spec/mysql2/statement_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ def stmt_count
7474
it "should handle booleans" do
7575
stmt = @client.prepare('SELECT ? AS `true`, ? AS `false`')
7676
result = stmt.execute(true, false)
77-
expect(result.to_a).to eq(['true' => 1, 'false' => 0])
77+
expect(result.to_a).to eq([{ 'true' => 1, 'false' => 0 }])
7878
end
7979

8080
it "should handle bignum but in int64_t" do
8181
stmt = @client.prepare('SELECT ? AS max, ? AS min')
8282
int64_max = (1 << 63) - 1
8383
int64_min = -(1 << 63)
8484
result = stmt.execute(int64_max, int64_min)
85-
expect(result.to_a).to eq(['max' => int64_max, 'min' => int64_min])
85+
expect(result.to_a).to eq([{ 'max' => int64_max, 'min' => int64_min }])
8686
end
8787

8888
it "should handle bignum but beyond int64_t" do
@@ -94,7 +94,7 @@ def stmt_count
9494
int64_min2 = -(1 << 64) + 1
9595
int64_min3 = -0xC000000000000000
9696
result = stmt.execute(int64_max1, int64_max2, int64_max3, int64_min1, int64_min2, int64_min3)
97-
expect(result.to_a).to eq(['max1' => int64_max1, 'max2' => int64_max2, 'max3' => int64_max3, 'min1' => int64_min1, 'min2' => int64_min2, 'min3' => int64_min3])
97+
expect(result.to_a).to eq([{ 'max1' => int64_max1, 'max2' => int64_max2, 'max3' => int64_max3, 'min1' => int64_min1, 'min2' => int64_min2, 'min3' => int64_min3 }])
9898
end
9999

100100
it "should accept keyword arguments on statement execute" do

0 commit comments

Comments
 (0)