Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Socket.unix #3798

Merged
merged 1 commit into from
Dec 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions spec/std/socket_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ describe Socket do
Socket.ip?("::0::ffff:c0a8:5e4").should be_false
Socket.ip?("c0a8").should be_false
end

describe ".unix" do
it "creates a unix socket" do
sock = Socket.unix
sock.should be_a(Socket)
sock.family.should eq(Socket::Family::UNIX)
sock.type.should eq(Socket::Type::STREAM)

sock = Socket.unix(Socket::Type::DGRAM)
sock.type.should eq(Socket::Type::DGRAM)
end
end
end

describe Socket::Addrinfo do
Expand Down
2 changes: 1 addition & 1 deletion src/socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Socket < IO::FileDescriptor

# Creates an UNIX socket. Consider using `UNIXSocket` or `UNIXServer` unless
# you need full control over the socket.
def self.unix(type : Type = Type::Stream, blocking = false)
def self.unix(type : Type = Type::STREAM, blocking = false)
new(Family::UNIX, type, blocking: blocking)
end

Expand Down