Sha256: 6d9f80a35ef1a36b667835c4906763abcdbcdcbecbaa7a72d754119b3ef6ede5

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

require 'spec_helper'

require 'socket'
require 'openssl'

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
    
    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

1 entries across 1 versions & 1 rubygems

Version Path
net-ldap-0.1.0 spec/integration/ssl_ber_spec.rb