diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 77d3bb0..e40a28f 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -25,25 +25,6 @@ test_df <- function(tibble = FALSE, factor = FALSE, missing = FALSE) { df } -test_package_root <- function() { - skip_if_not_installed("rprojroot") - x <- tryCatch( - rprojroot::find_package_root_file(), - error = function(e) NULL) - - if (!is.null(x)) return(x) - - pkg <- testthat::testing_package() - x <- tryCatch( - rprojroot::find_package_root_file( - path = file.path("..", "..", "00_pkg_src", pkg)), - error = function(e) NULL) - - if (!is.null(x)) return(x) - - stop("Cannot find package root") -} - test_write <- function(d, schema = NULL, encoding = NULL) { tmp <- tempfile(fileext = ".parquet") on.exit(unlink(tmp), add = TRUE) diff --git a/tests/testthat/test-spelling.R b/tests/testthat/test-spelling.R index 160b3c1..21bf92c 100644 --- a/tests/testthat/test-spelling.R +++ b/tests/testthat/test-spelling.R @@ -1,7 +1,12 @@ test_that("spelling", { skip_on_cran() skip_on_covr() - pkg <- test_package_root() + + pkg <- test_path("../../") + if (!file.exists(file.path(pkg, "DESCRIPTION"))) { + pkg <- file.path(pkg, "00_pkg_src", .packageName) + } + expect_snapshot({ spelling::spell_check_package(pkg) })