Skip to content

Commit 56be9fb

Browse files
author
‘topepo’
committed
use test fixtures
1 parent ad0a01b commit 56be9fb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

tests/testthat/test-new-blog-post.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
test_that("Create a blog post", {
22
skip_if_no_quarto("1.4")
33

4-
tempdir <- withr::local_tempdir()
5-
withr::local_dir(tempdir)
4+
current_dir <- getwd()
5+
6+
temp_dir <- withr::local_tempdir()
7+
dir_path <- fs::path(temp_dir, "test-blog-project")
8+
9+
withr::defer(fs::dir_delete(dir_path), envir = rlang::current_env())
10+
611
quarto_create_project(name = "test-blog-project", type = "blog",
7-
dir = tempdir(), quiet = TRUE)
12+
dir = temp_dir, quiet = TRUE)
13+
14+
setwd(dir_path)
15+
withr::defer(setwd(current_dir), envir = rlang::current_env())
816

917
# ------------------------------------------------------------------------------
1018

@@ -38,6 +46,7 @@ test_that("Create a blog post", {
3846
"Intro to Felt Surrogacy",
3947
dest = "The Science of Illusion",
4048
author = "Annie Edison",
49+
date = '2024-04-12',
4150
categories = c("shenanigans", "security"),
4251
open = FALSE)
4352

0 commit comments

Comments
 (0)