Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress Fixnum and Bignum warnings on Ruby 2.4. #907

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spec/mysql2/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ def run_gc
end

it "#socket should return a Fixnum (file descriptor from C)" do
expect(@client.socket).to be_an_instance_of(Fixnum)
expect(@client.socket).to be_an_instance_of(0.class)
expect(@client.socket).not_to eql(0)
end

Expand Down Expand Up @@ -852,7 +852,7 @@ def run_gc
info = @client.info
expect(info).to be_an_instance_of(Hash)
expect(info).to have_key(:id)
expect(info[:id]).to be_an_instance_of(Fixnum)
expect(info[:id]).to be_an_instance_of(0.class)
expect(info).to have_key(:version)
expect(info[:version]).to be_an_instance_of(String)
end
Expand Down Expand Up @@ -883,7 +883,7 @@ def run_gc
server_info = @client.server_info
expect(server_info).to be_an_instance_of(Hash)
expect(server_info).to have_key(:id)
expect(server_info[:id]).to be_an_instance_of(Fixnum)
expect(server_info[:id]).to be_an_instance_of(0.class)
expect(server_info).to have_key(:version)
expect(server_info[:version]).to be_an_instance_of(String)
end
Expand Down Expand Up @@ -974,7 +974,7 @@ def run_gc
end

it "#thread_id should be a Fixnum" do
expect(@client.thread_id).to be_an_instance_of(Fixnum)
expect(@client.thread_id).to be_an_instance_of(0.class)
end

it "should respond to #ping" do
Expand Down
12 changes: 6 additions & 6 deletions spec/mysql2/result_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
end

it "should return Fixnum for a TINYINT value" do
expect([Fixnum, Bignum]).to include(@test_result['tiny_int_test'].class)
expect(num_classes).to include(@test_result['tiny_int_test'].class)
expect(@test_result['tiny_int_test']).to eql(1)
end

Expand Down Expand Up @@ -248,27 +248,27 @@
end

it "should return Fixnum for a SMALLINT value" do
expect([Fixnum, Bignum]).to include(@test_result['small_int_test'].class)
expect(num_classes).to include(@test_result['small_int_test'].class)
expect(@test_result['small_int_test']).to eql(10)
end

it "should return Fixnum for a MEDIUMINT value" do
expect([Fixnum, Bignum]).to include(@test_result['medium_int_test'].class)
expect(num_classes).to include(@test_result['medium_int_test'].class)
expect(@test_result['medium_int_test']).to eql(10)
end

it "should return Fixnum for an INT value" do
expect([Fixnum, Bignum]).to include(@test_result['int_test'].class)
expect(num_classes).to include(@test_result['int_test'].class)
expect(@test_result['int_test']).to eql(10)
end

it "should return Fixnum for a BIGINT value" do
expect([Fixnum, Bignum]).to include(@test_result['big_int_test'].class)
expect(num_classes).to include(@test_result['big_int_test'].class)
expect(@test_result['big_int_test']).to eql(10)
end

it "should return Fixnum for a YEAR value" do
expect([Fixnum, Bignum]).to include(@test_result['year_test'].class)
expect(num_classes).to include(@test_result['year_test'].class)
expect(@test_result['year_test']).to eql(2009)
end

Expand Down
12 changes: 6 additions & 6 deletions spec/mysql2/statement_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ def stmt_count
end

it "should return Fixnum for a TINYINT value" do
expect([Fixnum, Bignum]).to include(@test_result['tiny_int_test'].class)
expect(num_classes).to include(@test_result['tiny_int_test'].class)
expect(@test_result['tiny_int_test']).to eql(1)
end

Expand Down Expand Up @@ -420,27 +420,27 @@ def stmt_count
end

it "should return Fixnum for a SMALLINT value" do
expect([Fixnum, Bignum]).to include(@test_result['small_int_test'].class)
expect(num_classes).to include(@test_result['small_int_test'].class)
expect(@test_result['small_int_test']).to eql(10)
end

it "should return Fixnum for a MEDIUMINT value" do
expect([Fixnum, Bignum]).to include(@test_result['medium_int_test'].class)
expect(num_classes).to include(@test_result['medium_int_test'].class)
expect(@test_result['medium_int_test']).to eql(10)
end

it "should return Fixnum for an INT value" do
expect([Fixnum, Bignum]).to include(@test_result['int_test'].class)
expect(num_classes).to include(@test_result['int_test'].class)
expect(@test_result['int_test']).to eql(10)
end

it "should return Fixnum for a BIGINT value" do
expect([Fixnum, Bignum]).to include(@test_result['big_int_test'].class)
expect(num_classes).to include(@test_result['big_int_test'].class)
expect(@test_result['big_int_test']).to eql(10)
end

it "should return Fixnum for a YEAR value" do
expect([Fixnum, Bignum]).to include(@test_result['year_test'].class)
expect(num_classes).to include(@test_result['year_test'].class)
expect(@test_result['year_test']).to eql(2009)
end

Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def new_client(option_overrides = {})
end
end

def num_classes
0.class == Integer ? [Integer] : [Fixnum, Bignum]
end

config.before :each do
@client = new_client
end
Expand Down