[mirror] Opinionated R package quickstart
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixed tests

VisruthSK 0fd827d8 ee92ce8b

+38 -22
+24
tests/testthat/test-bootstrapper.R
··· 138 138 .package = "bootstrapper" 139 139 ) 140 140 141 + testthat::local_mocked_bindings( 142 + update_wordlist = function(confirm = FALSE) { 143 + expect_false(confirm) 144 + NULL 145 + }, 146 + .package = "spelling" 147 + ) 148 + 141 149 expect_null(bootstrapper::pkg_setup()) 142 150 143 151 expect_true("testthat" %in% calls$actions) ··· 186 194 .package = "bootstrapper" 187 195 ) 188 196 197 + testthat::local_mocked_bindings( 198 + update_wordlist = function(confirm = FALSE) { 199 + expect_false(confirm) 200 + NULL 201 + }, 202 + .package = "spelling" 203 + ) 204 + 189 205 expect_null( 190 206 bootstrapper::pkg_setup( 191 207 setup_gha = FALSE, ··· 219 235 find_replace_in_file = function(from, to, file, fixed = TRUE) NULL, 220 236 try_air_jarl_format = function() NULL, 221 237 .package = "bootstrapper" 238 + ) 239 + 240 + testthat::local_mocked_bindings( 241 + update_wordlist = function(confirm = FALSE) { 242 + expect_false(confirm) 243 + NULL 244 + }, 245 + .package = "spelling" 222 246 ) 223 247 224 248 expect_null(bootstrapper::pkg_setup(
+14 -22
tests/testthat/test-workflow.R
··· 1 1 run_workflow_fixture <- function(setup_AGENTS = TRUE) { 2 2 tmp <- tempfile("bootstrapper-workflow-") 3 3 dir.create(tmp) 4 + pkg <- "demoPkg" 5 + pkg_path <- fs::path(tmp, pkg) 6 + dir.create(pkg_path) 4 7 old <- setwd(tmp) 5 8 on.exit(setwd(old), add = TRUE) 9 + setwd(pkg_path) 6 10 7 - pkg <- "demoPkg" 8 11 fields <- list("Package" = pkg) 9 12 state <- new.env(parent = emptyenv()) 10 - state$github_private <- NULL 11 13 state$action_calls <- list() 12 14 13 15 testthat::local_mocked_bindings( 14 16 create_package = function(path, fields, ...) { 15 - expect_identical(path, pkg) 17 + expect_identical(path, ".") 16 18 expect_identical(fields, list("Package" = pkg)) 17 19 expect_identical(list(...), list(open = FALSE)) 18 20 19 - fs::dir_create(path) 20 - setwd(path) 21 21 writeLines( 22 22 c("^.*\\.Rproj$", "^\\.Rproj\\.user$", "README\\.Rmd"), 23 23 ".Rbuildignore" ··· 25 25 writeLines(c("Package: demoPkg", "Version: 0.0.0.9000"), "DESCRIPTION") 26 26 writeLines("project", "demoPkg.Rproj") 27 27 fs::dir_create(fs::path(".git", "hooks")) 28 - NULL 29 - }, 30 - use_github = function(private) { 31 - state$github_private <- private 32 - writeLines( 33 - c( 34 - "[remote \"origin\"]", 35 - "\turl = git@github.com:example/demoPkg.git" 36 - ), 37 - fs::path(".git", "config") 38 - ) 39 28 NULL 40 29 }, 41 30 use_testthat = function() { ··· 133 122 .package = "bootstrapper" 134 123 ) 135 124 125 + testthat::local_mocked_bindings( 126 + update_wordlist = function(confirm = FALSE) { 127 + expect_false(confirm) 128 + NULL 129 + }, 130 + .package = "spelling" 131 + ) 132 + 136 133 expect_null( 137 134 bootstrapper::bootstrapper( 138 - path = pkg, 139 135 fields = fields, 140 - private = TRUE, 141 136 setup_AGENTS = setup_AGENTS, 142 137 open = FALSE 143 138 ) 144 139 ) 145 140 146 141 list( 147 - pkg_path = fs::path(tmp, pkg), 148 - github_private = state$github_private, 142 + pkg_path = pkg_path, 149 143 action_calls = state$action_calls 150 144 ) 151 145 } ··· 180 174 test_that("workflow step: create_package creates git-backed package skeleton", { 181 175 fixture <- run_workflow_fixture() 182 176 183 - expect_true(isTRUE(fixture$github_private)) 184 - expect_true(file.exists(file_in_pkg(fixture, ".git", "config"))) 185 177 expect_false(file.exists(file_in_pkg(fixture, "demoPkg.Rproj"))) 186 178 187 179 old <- setwd(fixture$pkg_path)