test_that("encrypted_rds functions work as expected", {
dat1 <- data.frame(x = letters[1:4], y = 1:4, stringsAsFactors = FALSE)
# encrypt contents and write to file
file_write <- file.path(tempdir(), "dat.rds")
save_encrypted_rds(dat1, file_write, passphrase = "blah123")
# read and decrypt
dat2 <- read_encrypted_rds(file_write, passphrase = "blah123")
# test equal
expect_equal(dat1, dat2)
# expect error if wrong password
expect_error(read_encrypted_rds(file_write, passphrase = "wrong_password"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.