File: unix_server_spec.rb

package info (click to toggle)
ruby-cool.io 1.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 716 kB
  • sloc: ansic: 6,851; ruby: 1,730; makefile: 6
file content (27 lines) | stat: -rw-r--r-- 820 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require File.expand_path('../spec_helper', __FILE__)
require 'tempfile'

describe Cool.io::UNIXServer, :env => :exclude_win do

  before :each do
    @tmp = Tempfile.new('coolio_unix_server_spec')
    expect(File.unlink(@tmp.path)).to eq(1)
    expect(File.exist?(@tmp.path)).to eq(false)
  end

  it "creates a new Cool.io::UNIXServer" do
    listener = Cool.io::UNIXListener.new(@tmp.path)
    listener.listen(24)
    expect(File.socket?(@tmp.path)).to eq(true)
  end

  it "builds off an existing ::UNIXServer" do
    unix_server = ::UNIXServer.new(@tmp.path)
    expect(File.socket?(@tmp.path)).to eq(true)
    listener = Cool.io::UNIXServer.new(unix_server, Coolio::UNIXSocket)
    listener.listen(24)
    expect(File.socket?(@tmp.path)).to eq(true)
    expect(listener.fileno).to eq(unix_server.fileno)
  end

end