Skip to content

Commit

Permalink
use test fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
‘topepo’ committed Apr 16, 2024
1 parent ad0a01b commit 56be9fb
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions tests/testthat/test-new-blog-post.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
test_that("Create a blog post", {
skip_if_no_quarto("1.4")

tempdir <- withr::local_tempdir()
withr::local_dir(tempdir)
current_dir <- getwd()

temp_dir <- withr::local_tempdir()
dir_path <- fs::path(temp_dir, "test-blog-project")

withr::defer(fs::dir_delete(dir_path), envir = rlang::current_env())

quarto_create_project(name = "test-blog-project", type = "blog",
dir = tempdir(), quiet = TRUE)
dir = temp_dir, quiet = TRUE)

setwd(dir_path)
withr::defer(setwd(current_dir), envir = rlang::current_env())

# ------------------------------------------------------------------------------

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

Expand Down

0 comments on commit 56be9fb

Please sign in to comment.