instance.reachable?: Limit to binary input
This commit is contained in:
parent
e1a2e8b17c
commit
1403798820
|
@ -77,7 +77,7 @@ def reachable?(url_or_host) when is_binary(url_or_host) do
|
|||
)
|
||||
end
|
||||
|
||||
def reachable?(_), do: true
|
||||
def reachable?(url_or_host) when is_binary(url_or_host), do: true
|
||||
|
||||
def set_reachable(url_or_host) when is_binary(url_or_host) do
|
||||
with host <- host(url_or_host),
|
||||
|
|
|
@ -32,9 +32,9 @@ test "returns `true` for host / url marked unreachable for less than `reachabili
|
|||
assert Instances.reachable?(URI.parse(url).host)
|
||||
end
|
||||
|
||||
test "returns true on non-binary input" do
|
||||
assert Instances.reachable?(nil)
|
||||
assert Instances.reachable?(1)
|
||||
test "raises FunctionClauseError exception on non-binary input" do
|
||||
assert_raise FunctionClauseError, fn -> Instances.reachable?(nil) end
|
||||
assert_raise FunctionClauseError, fn -> Instances.reachable?(1) end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue