Skip to content

Commit 94f1229

Browse files
committed
fix tests
1 parent dd0880e commit 94f1229

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

R/blog.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ make_post_dir <- function(dest, wd, call) {
5959
# is this a quarto project for blog ? Expecting _quarto.yml in working dir
6060
if (!fs::file_exists(fs::path(working, "_quarto.yml"))) {
6161
cli::cli_abort(
62-
"You need to be at root of a Quarto project to create a blog post in the {.file posts/} directory at {.file {working}}.",
62+
"You need to be at root of a Quarto project to create a blog post in the {.file posts/} directory at {.file {fs::path_real(working)}}.",
6363
call = call
6464
)
6565
}

R/utils.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ in_rstudio <- function() {
4949
hide_path <- function(path) {
5050
function(x) {
5151
x <- gsub(path, "<project directory>", x, fixed = TRUE)
52-
gsub(fs::path_norm(path), "<project directory>", x, fixed = TRUE)
52+
gsub(fs::path_real(path), "<project directory>", x, fixed = TRUE)
5353
}
5454
}

tests/testthat/_snaps/blog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Create a blog post
2+
3+
Code
4+
new_blog_post("Intro to Felt Surrogacy", data = "1999-12-31", open = FALSE)
5+
Condition
6+
Error in `new_blog_post()`:
7+
! There is already a 'intro-to-felt-surrogacy' directory in 'posts/'
8+
19
# Error if not a quarto project
210

311
Code

tests/testthat/test-blog.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ test_that("Create a blog post", {
55
dir_path <- withr::local_tempdir(pattern = "test-blog-project-")
66
withr::local_dir(dir_path)
77

8+
proj_name <- "test-blog-project"
9+
810
quarto_create_project(
9-
name = "test-blog-project",
11+
name = proj_name,
1012
type = "blog",
1113
dir = dir_path,
1214
quiet = TRUE,
1315
no_prompt = TRUE
1416
)
1517

18+
withr::local_dir(proj_name)
19+
1620
withr::local_envvar(list(FULLNAME = "Max Kuhn"))
1721

1822
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)