Sha256: 9077ef609f479b12e3ebafab659edd48b46c36a416013d8ce2a000b47cb2651a

Contents?: true

Size: 890 Bytes

Versions: 4

Compression:

Stored size: 890 Bytes

Contents

require File.expand_path('../../fixtures/classes', __FILE__)
require File.expand_path('../../shared/partially_closable_sockets', __FILE__)

describe "UNIXSocket#pair" do
  platform_is_not :windows do

    it_should_behave_like "partially closable sockets"

    before :each do
      @s1, @s2 = UNIXSocket.pair
    end

    after :each do
      @s1.close
      @s2.close
    end

    it "returns a pair of connected sockets" do
      @s1.puts "foo"
      @s2.gets.should == "foo\n"
    end

    it "returns sockets with no name" do
      @s1.path.should == @s2.path
      @s1.path.should == ""
    end

    it "returns sockets with no address" do
      @s1.addr.should == ["AF_UNIX", ""]
      @s2.addr.should == ["AF_UNIX", ""]
    end

    it "returns sockets with no peeraddr" do
      @s1.peeraddr.should == ["AF_UNIX", ""]
      @s2.peeraddr.should == ["AF_UNIX", ""]
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubysl-socket-1.0.1 spec/unixsocket/pair_spec.rb
rubysl-socket-2.0.1 spec/unixsocket/pair_spec.rb
rubysl-socket-1.0.0 spec/unixsocket/pair_spec.rb
rubysl-socket-2.0.0 spec/unixsocket/pair_spec.rb