test/test_ssl_ber.rb in net-ldap-0.16.2 vs test/test_ssl_ber.rb in net-ldap-0.16.3

- old
+ new

@@ -3,11 +3,11 @@ class TestSSLBER < Test::Unit::TestCase # Transmits str to @to and reads it back from @from. # def transmit(str) - Timeout::timeout(1) do + Timeout.timeout(1) do @to.write(str) @to.close @from.read end @@ -20,21 +20,25 @@ # on them to work. Pipes are more robust for this test, so we'll skip # the #connect call since it fails. # # TODO: Replace test with real socket # https://github.com/ruby-ldap/ruby-net-ldap/pull/121#discussion_r18746386 - flexmock(OpenSSL::SSL::SSLSocket). - new_instances.should_receive(:connect => nil) + flexmock(OpenSSL::SSL::SSLSocket) + .new_instances.should_receive(:connect => nil) @to = Net::LDAP::Connection.wrap_with_ssl(@to) @from = Net::LDAP::Connection.wrap_with_ssl(@from) end def test_transmit_strings + 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_if RUBY_PLATFORM == "java", "JRuby throws an error without a real socket" + @to.write 1234.to_ber assert_equal 1234, @from.read_ber end end