Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion spec/std/socket/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ require "spec"
require "socket"

module SocketSpecHelper
class_getter?(supports_ipv6 : Bool) do
class_getter?(supports_ipv6 : Bool) { detect_supports_ipv6? }

private def self.detect_supports_ipv6? : Bool
TCPServer.open("::1", 0) { return true }
false
rescue Socket::Error
Expand Down
4 changes: 3 additions & 1 deletion spec/support/time.cr
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ end
# Enable the `SeTimeZonePrivilege` privilege before changing the system time
# zone. This is necessary because the privilege is by default granted but
# disabled for any new process. This only needs to be done once per run.
class_getter? time_zone_privilege_enabled : Bool do
class_getter?(time_zone_privilege_enabled : Bool) { detect_time_zone_privilege_enabled? }

private def self.detect_time_zone_privilege_enabled? : Bool
if LibC.LookupPrivilegeValueW(nil, SeTimeZonePrivilege, out time_zone_luid) == 0
raise RuntimeError.from_winerror("LookupPrivilegeValueW")
end
Expand Down