Sha256: ac8c42701831c174c565ea88f02fc1a8e623fc3bccb5d6b8b6c143401ab7caaa

Contents?: true

Size: 899 Bytes

Versions: 14

Compression:

Stored size: 899 Bytes

Contents

require 'spec_helper'

require 'net/ldap'

describe "BER serialisation (SSL)" do
  # Transmits str to #to and reads it back from #from. 
  #
  def transmit(str)
    to.write(str)
    to.close
    
    from.read
  end
    
  attr_reader :to, :from
  before(:each) do
    @from, @to = IO.pipe
    
    # The production code operates on sockets, which do need #connect called
    # on them to work. Pipes are more robust for this test, so we'll skip 
    # the #connect call since it fails. 
    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
  
  it "should transmit strings" do
    transmit('foo').should == 'foo'
  end 
  it "should correctly transmit numbers" do
    to.write 1234.to_ber
    from.read_ber.should == 1234
  end 
end

Version data entries

14 entries across 14 versions & 7 rubygems

Version Path
net-ldap-0.6.1 spec/integration/ssl_ber_spec.rb
net-ldap-0.6.0 spec/integration/ssl_ber_spec.rb
net-ldap-0.5.1 spec/integration/ssl_ber_spec.rb
datacom-net-ldap-0.5.0.datacom spec/integration/ssl_ber_spec.rb
adams-net-ldap-0.4.0 spec/integration/ssl_ber_spec.rb
obis-net-ldap-0.4.0 spec/integration/ssl_ber_spec.rb
net-ldap-1-0.4.0 spec/integration/ssl_ber_spec.rb
net-ldap-0.3.1 spec/integration/ssl_ber_spec.rb
net-ldap-0.3.0 spec/integration/ssl_ber_spec.rb
prathe_net-ldap-0.2.20110317223538 spec/integration/ssl_ber_spec.rb
prathe-net-ldap-0.2.20110317223538 spec/integration/ssl_ber_spec.rb
net-ldap-0.2.2 spec/integration/ssl_ber_spec.rb
net-ldap-0.2.1 spec/integration/ssl_ber_spec.rb
net-ldap-0.2 spec/integration/ssl_ber_spec.rb