Skip to content

Commit

Permalink
V0.3.1 rc (release for addressing CRAN errors) (#115)
Browse files Browse the repository at this point in the history
* Update create_credentials.R

It is thought that including the only function from the `getPass` pkg in an argument leads some CRAN check machines to believe the Import is unused. This change is thus just for passing R CMD check more widely.

* Limit testing of rmarkdown-based tests

To only those systems with Pandoc 2

* Update Version and NEWS.md

* Added SystemRequirements (pandoc)

This is required according to WRE.

* Substitute function used for checking Pandoc status

Now using the exported `rmarkdown::pandoc_available()` function.
  • Loading branch information
rich-iannone authored Nov 27, 2019
1 parent 16fe481 commit cdc67df
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 37 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: blastula
Title: Easily Send HTML Email Messages
Version: 0.3.0
Version: 0.3.1
Authors@R: c(
person("Richard", "Iannone", role = c("aut", "cre"), email = "[email protected]",
comment = c(ORCID = "0000-0003-3925-190X")),
Expand Down Expand Up @@ -45,6 +45,7 @@ Suggests:
knitr,
spelling,
xml2
SystemRequirements: pandoc (>= 1.12.3) - http://pandoc.org
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# blastula 0.3.1

This release contains fixes for R CMD check problems on CRAN test machines.

# blastula 0.3.0

The **blastula** package has transitioned to using the **curl** package for SMTP mailing.
Expand Down
14 changes: 13 additions & 1 deletion R/create_credentials.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,24 @@ create_smtp_creds_key <- function(id,
# nocov end
}

#' Ask for a password
#'
#' @noRd
get_password <- function(msg = "Enter the SMTP server password: ") {

# nocov start

getPass::getPass(msg = msg)

# nocov end
}

#' Create a credentials list object
#'
#' @noRd
create_credentials_list <- function(provider,
user,
password = getPass::getPass("Enter the SMTP server password: "),
password = get_password(),
host,
port,
use_ssl) {
Expand Down
75 changes: 40 additions & 35 deletions tests/testthat/test-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,52 @@ context("Utility functions work as expected")

test_that("knitr_sidecar_prefix preconditions hold", {

# Ensure that rmarkdown assumptions still hold
rmd_path <- file.path(tempdir(), "test-utils.Rmd")
if (rmarkdown::pandoc_available()) {

file.copy(testthat::test_path("test-utils.Rmd"), rmd_path)
# Ensure that rmarkdown assumptions still hold
rmd_path <- file.path(tempdir(), "test-utils.Rmd")

rmarkdown::render(rmd_path, quiet = TRUE)
file.copy(testthat::test_path("test-utils.Rmd"), rmd_path)

rmarkdown::render(rmd_path, quiet = TRUE)
}
})

test_that("knitr_sidecar_prefix behavior", {

# fig.path isn't set
expect_null(knitr_sidecar_prefix(NULL))
expect_null(knitr_sidecar_prefix(NULL, condition = FALSE))
expect_null(knitr_sidecar_prefix(NULL, condition = TRUE))
expect_identical("default", knitr_sidecar_prefix("default"))
expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE))
expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE))

# Explicitly provide an unusable fig.path
expect_null(knitr_sidecar_prefix(NULL, fig_path = "."))
expect_null(knitr_sidecar_prefix(NULL, condition = FALSE, fig_path = "."))
expect_null(knitr_sidecar_prefix(NULL, condition = TRUE, fig_path = "."))
expect_identical("default", knitr_sidecar_prefix("default", fig_path = "."))
expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE, fig_path = "."))
expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE, fig_path = "."))

# Usable fig.path provided
expect_identical(
knitr_sidecar_prefix(NULL, condition = TRUE,
fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/"),
"a12 !_-x_files/b"
)
expect_null(
knitr_sidecar_prefix(NULL, condition = FALSE,
fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/")
)
expect_null(
knitr_sidecar_prefix(NULL,
fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/")
)

if (rmarkdown::pandoc_available()) {

# fig.path isn't set
expect_null(knitr_sidecar_prefix(NULL))
expect_null(knitr_sidecar_prefix(NULL, condition = FALSE))
expect_null(knitr_sidecar_prefix(NULL, condition = TRUE))
expect_identical("default", knitr_sidecar_prefix("default"))
expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE))
expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE))

# Explicitly provide an unusable fig.path
expect_null(knitr_sidecar_prefix(NULL, fig_path = "."))
expect_null(knitr_sidecar_prefix(NULL, condition = FALSE, fig_path = "."))
expect_null(knitr_sidecar_prefix(NULL, condition = TRUE, fig_path = "."))
expect_identical("default", knitr_sidecar_prefix("default", fig_path = "."))
expect_identical("default", knitr_sidecar_prefix("default", condition = FALSE, fig_path = "."))
expect_identical("default", knitr_sidecar_prefix("default", condition = TRUE, fig_path = "."))

# Usable fig.path provided
expect_identical(
knitr_sidecar_prefix(NULL, condition = TRUE,
fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/"),
"a12 !_-x_files/b"
)
expect_null(
knitr_sidecar_prefix(NULL, condition = FALSE,
fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/")
)
expect_null(
knitr_sidecar_prefix(NULL,
fig_path = "a12 !_-x_files/b_files/figure-github_flavored_markdown/")
)
}
})

test_that("the `smtp_settings()` function returns the expected output", {
Expand Down

0 comments on commit cdc67df

Please sign in to comment.