diff --git a/R/boxr__internal_misc.R b/R/boxr__internal_misc.R index c06e1e6..3f81e37 100644 --- a/R/boxr__internal_misc.R +++ b/R/boxr__internal_misc.R @@ -294,7 +294,6 @@ create_test_dir <- function() { return() } - # A function to modify that directory structure modify_test_dir <- function() { # Delete a directory @@ -314,9 +313,8 @@ modify_test_dir <- function() { # A function to clear out a box.com directory clear_box_dir <- function(dir_id) { - dir.create("delete_me", showWarnings = FALSE) - box_push(dir_id, "delete_me", delete = TRUE) - unlink("delete_me", recursive = TRUE, force = TRUE) + tmp_dir <- withr::local_tempdir() + box_push(dir_id, tmp_dir, delete = TRUE) } diff --git a/tests/testthat/test_02_clear_out.R b/tests/testthat/test_02_clear_out.R index 7b389ff..42e7c0a 100644 --- a/tests/testthat/test_02_clear_out.R +++ b/tests/testthat/test_02_clear_out.R @@ -20,7 +20,7 @@ test_that("Clear out the remote directory", { options(boxr.verbose = FALSE) # Tell boxr to sync the remote home directory with an empty local one # (i.e. delete everything) - b <- box_push(0, fs::path_temp("test_dir/dir_12/dir_121/dir_1211"), delete = TRUE) + boxr:::clear_box_dir(0) expect_length(box_ls(0), 0) diff --git a/tests/testthat/test_99_tidy_up.R b/tests/testthat/test_99_tidy_up.R index 620ebdb..7b0d6d7 100644 --- a/tests/testthat/test_99_tidy_up.R +++ b/tests/testthat/test_99_tidy_up.R @@ -5,8 +5,7 @@ test_that("Box directory is emptied", { boxr:::skip_on_travis() skip_if_no_token() - # push empty local dir to top level on Box - b <- box_push(0, fs::path_temp("test_dir/dir_12/dir_121/dir_1211"), delete = TRUE) + boxr:::clear_box_dir(0) expect_equal(nrow(as.data.frame(box_ls(0))), 0) })