From 39bf55582312d041139d7a600e08191b860788b8 Mon Sep 17 00:00:00 2001 From: Kevin McCormack Date: Sun, 12 Jul 2020 16:16:16 -0400 Subject: [PATCH] Address some warnings and fix JRuby test omissions --- lib/net/ldap/filter.rb | 2 +- test/test_ldap_connection.rb | 2 +- test/test_snmp.rb | 2 +- test/test_ssl_ber.rb | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/net/ldap/filter.rb b/lib/net/ldap/filter.rb index 88b80ba8..dc0d0ab3 100644 --- a/lib/net/ldap/filter.rb +++ b/lib/net/ldap/filter.rb @@ -490,7 +490,7 @@ def to_ber when :eq if @right == "*" # presence test @left.to_s.to_ber_contextspecific(7) - elsif @right =~ /[*]/ # substring + elsif @right.to_s =~ /[*]/ # substring # Parsing substrings is a little tricky. We use String#split to # break a string into substrings delimited by the * (star) # character. But we also need to know whether there is a star at the diff --git a/test/test_ldap_connection.rb b/test/test_ldap_connection.rb index cdc2523b..9763c713 100644 --- a/test/test_ldap_connection.rb +++ b/test/test_ldap_connection.rb @@ -95,7 +95,7 @@ def test_connection_refused def test_connection_timeout connection = Net::LDAP::Connection.new(:host => "fail.Errno::ETIMEDOUT", :port => 636, :socket_class => FakeTCPSocket) - stderr = capture_stderr do + capture_stderr do assert_raise Net::LDAP::Error do connection.socket end diff --git a/test/test_snmp.rb b/test/test_snmp.rb index b6d1e9c8..4199bce8 100644 --- a/test/test_snmp.rb +++ b/test/test_snmp.rb @@ -17,7 +17,7 @@ def self.raw_string(s) def test_invalid_packet data = "xxxx" assert_raise(Net::BER::BerError) do - ary = data.read_ber(Net::SNMP::AsnSyntax) + data.read_ber(Net::SNMP::AsnSyntax) end end diff --git a/test/test_ssl_ber.rb b/test/test_ssl_ber.rb index 532635f6..5677ea0d 100644 --- a/test/test_ssl_ber.rb +++ b/test/test_ssl_ber.rb @@ -30,15 +30,13 @@ def setup end def test_transmit_strings - omit "JRuby throws an error without a real socket" - omit_if RUBY_PLATFORM == "java" + omit_if RUBY_PLATFORM == "java", "JRuby throws an error without a real socket" assert_equal "foo", transmit("foo") end def test_transmit_ber_encoded_numbers - omit "JRuby throws an error without a real socket" - omit_if RUBY_PLATFORM == "java" + omit_if RUBY_PLATFORM == "java", "JRuby throws an error without a real socket" @to.write 1234.to_ber assert_equal 1234, @from.read_ber