tests/testthat/test-use-package-doc.R

context("use_package_doc")

test_that("use_package_doc() requires a package", {
  scoped_temporary_project()
  expect_false(has_package_doc())
  expect_usethis_error(use_package_doc(), "not an R package")
})

test_that("use_package_doc() creates the promised file", {
  scoped_temporary_package()
  use_package_doc()
  expect_proj_file("R", paste0(project_name(), "-package.R"))
  expect_true(has_package_doc())
})

Try the usethis package in your browser

Any scripts or data that you put into this service are public.

usethis documentation built on July 4, 2019, 5:05 p.m.