Skip to content

Commit

Permalink
Suppress Fixnum and Bignum warnings on Ruby 2.4. (brianmario#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
junaruga committed Nov 27, 2017
1 parent 59e446d commit 235eaa4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
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

0 comments on commit 235eaa4

Please sign in to comment.