Skip to content

Commit

Permalink
Add snapshot test for no_prompt = FALSE
Browse files Browse the repository at this point in the history
  • Loading branch information
cderv committed Jan 24, 2024
1 parent 68b6df5 commit 0818256
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions tests/testthat/_snaps/use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# quarto_use_binder works

Code
quarto_use_binder(no_prompt = FALSE)
Condition
Error in `quarto_use_binder()`:
! `quarto use binder` requires explicit approval as it will write some configurations files to your project.
> Set `no_prompt = TRUE` if you agree.
i See more at <https://quarto.org/docs/projects/binder.html>

10 changes: 8 additions & 2 deletions tests/testthat/test-use.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test_that("Installing an extension", {
})

test_that("quarto_use_binder errors < 1.4", {
skip_if_quarto(ver = 1.4)
skip_if_quarto(ver = "1.4")
expect_snapshot(
error = TRUE,
quarto_use_binder(),
Expand All @@ -21,7 +21,8 @@ test_that("quarto_use_binder errors < 1.4", {

test_that("quarto_use_binder works", {
skip_on_cran()
skip_if_no_quarto(ver = 1.4)
skip_if_no_quarto(ver = "1.4")

project <- local_quarto_project(
c("---",
"title: Histogram",
Expand All @@ -31,6 +32,11 @@ test_that("quarto_use_binder works", {
"hist(rnorm(100))",
"```")
)
expect_snapshot(
error = TRUE,
quarto_use_binder(no_prompt = FALSE)
)
withr::local_dir(project)
skip_if_no_quarto(ver = "1.5")
quarto_use_binder(no_prompt = TRUE)
})

0 comments on commit 0818256

Please sign in to comment.