context("test-source_rmd")
# set parameters
output_data <- "ds_mt_temp.rds"
dir_testdata <- here::here("inst", "testdata")
file_test_rmd <- paste(dir_testdata, "test_case_for_source_rmd.Rmd", sep = "/")
# The test
source_rmd(file_test_rmd)
test_that("source_rmd generates data", {
expect_true(output_data %in% list.files(dir_testdata))
})
# remove the data b/c you created that data for testing purposes
file.remove(list = paste(dir_testdata, output_data, sep = "/"))
# More tests
test_that("source_rmd does not generate html report", {
expect_false("ds_mt_temp.html" %in% list.files(dir_testdata))
})
test_that("source_rmd does not generate .md object in root directory", {
expect_false("ds_mt_temp.html" %in% list.files(here::here()))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.