)
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),
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