Skip to content

Commit e46f21f

Browse files
committed
test: with expect_installed
1 parent 85fe211 commit e46f21f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/testthat/test-install_dev_deps.R

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
expect_installed <- function(pkg) {
2+
expect(
3+
rlang::is_installed(pkg),
4+
failure_message = paste0(
5+
"Package '", pkg, "' is not installed. Installed from ",
6+
getOption("repos")
7+
)
8+
)
9+
}
10+
111
test_that("install_dev_deps works", {
212
withr::with_temp_libpaths({
313
install_dev_deps(
@@ -20,15 +30,13 @@ test_that("install_dev_deps works", {
2030
"processx",
2131
"rsconnect",
2232
"testthat",
23-
"rstudioapi"
33+
"rstudioapi", "piff"
2434
)
2535
)
2636
for (
2737
pak in paks
2838
) {
29-
expect_true(
30-
rlang::is_installed(pak)
31-
)
39+
expect_installed(pak)
3240
}
3341
})
3442
})

0 commit comments

Comments
 (0)