diff --git a/R/utils.R b/R/utils.R index b1b6b74c5..65b95786e 100644 --- a/R/utils.R +++ b/R/utils.R @@ -716,14 +716,10 @@ wb_dims <- function(..., select = NULL) { } if (!is.null(cols_arg)) { - # cols_arg could be name(s) in x or must indicate a positive integer is_lwr_one <- FALSE - if (!is.null(args$x)) { - if (!all(cols_arg %in% names(args$x))) - is_lwr_one <- min(col2int(cols_arg)) < 1L - } else { + # cols_arg could be name(s) in x or must indicate a positive integer + if (is.null(args$x) || (!is.null(args$x) && !all(cols_arg %in% names(args$x)))) is_lwr_one <- min(col2int(cols_arg)) < 1L - } if (is_lwr_one) stop("You must supply positive values to `cols`") diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 231a4c73a..dec2404db 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -1044,9 +1044,20 @@ testsetup <- function() { } +dns_lookup <- function(host = "captive.apple.com") { + con <- try( + socketConnection(host, port = 80, open = "r+", timeout = 2), + silent = TRUE + ) + on.exit(close(con)) + + if (inherits(con, "try-error")) return(FALSE) + + TRUE +} + # testthat::skip_if_offline requires curl, but fails if curl is not available skip_online_checks <- function() { testthat::skip_on_cran() - testthat::skip_if_not_installed("curl") - testthat::skip_if_offline() + testthat::skip_if_not(dns_lookup()) }