Skip to content

Commit

Permalink
move test files
Browse files Browse the repository at this point in the history
  • Loading branch information
nuest committed Mar 23, 2018
1 parent 34b1756 commit 1d4190e
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ inst/doc
*.Rproj
*.out

tests/testthat/package_markdown/markdowntainer-units/images/
tests/testthat/package_markdown/markdowntainer-units/*\.html
tests/testthat/package_markdown/units/images/
tests/testthat/package_markdown/units/*\.html

tests/testthat/Rplots\.pdf
4 changes: 2 additions & 2 deletions tests/testthat/package_markdown/units_Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ RUN export DEBIAN_FRONTEND=noninteractive; apt-get -y update \
pandoc-citeproc
RUN ["install2.r", "backports", "colorspace", "digest", "evaluate", "ggplot2", "gtable", "htmltools", "knitr", "labeling", "lazyeval", "magrittr", "munsell", "plyr", "Rcpp", "rlang", "rmarkdown", "rprojroot", "scales", "stringi", "stringr", "tibble", "udunits2", "units", "yaml"]
WORKDIR /payload/
COPY ["package_markdown/markdowntainer-units", "package_markdown/markdowntainer-units/"]
CMD ["R", "--vanilla", "-e", "rmarkdown::render(input = \"package_markdown/markdowntainer-units/2016-09-29-plot_units.Rmd\", output_format = rmarkdown::html_document())"]
COPY ["package_markdown/units", "package_markdown/units/"]
CMD ["R", "--vanilla", "-e", "rmarkdown::render(input = \"package_markdown/units/2016-09-29-plot_units.Rmd\", output_format = rmarkdown::html_document())"]
16 changes: 8 additions & 8 deletions tests/testthat/test_package_markdown.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

context("Package R markdown files")

test_that("A markdown file can be packaged (using markdowntainer-units-expample)", {
test_that("A markdown file can be packaged (using units expample)", {
skip("FIXME, works when run single, but not when run with full package check")

df <- dockerfile(from = "package_markdown/markdowntainer-units/",
df <- dockerfile(from = "package_markdown/units/",
maintainer = "Ted Tester",
image = getImageForVersion("3.3.2"),
copy = "script_dir",
cmd = CMD_Render("package_markdown/markdowntainer-units/2016-09-29-plot_units.Rmd"))
cmd = CMD_Render("package_markdown/units/2016-09-29-plot_units.Rmd"))
#write(df, "package_markdown/units_Dockerfile")
expected_file <- readLines("package_markdown/units_Dockerfile")
generated_file <- unlist(stringr::str_split(toString(df),"\n"))
Expand Down Expand Up @@ -59,23 +59,23 @@ test_that("The render command supports output directory and output file at the s
})

test_that("The file is copied", {
df_copy <- dockerfile(from = "package_markdown/markdowntainer-units/", copy = "script")
df_copy <- dockerfile(from = "package_markdown/units/", copy = "script")
expect_true(object = any(sapply(df_copy@instructions, function(x) { inherits(x, "Copy") })), info = "at least one Copy instruction")
})

test_that("File copying is disabled by default", {
df_copy <- dockerfile(from = "package_markdown/markdowntainer-units/")
df_copy <- dockerfile(from = "package_markdown/units/")
expect_false(object = any(sapply(df_copy@instructions, function(x) { inherits(x, "Copy") })), info = "no Copy instruction")
})

test_that("File copying can be disabled with NA/NA_character", {
df_copy <- dockerfile(from = "package_markdown/markdowntainer-units/", copy = NA_character_)
df_copy <- dockerfile(from = "package_markdown/units/", copy = NA_character_)
expect_false(object = any(sapply(df_copy@instructions, function(x) { inherits(x, "Copy") })), info = "no Copy instruction")
df_copy2 <- dockerfile(from = "package_markdown/markdowntainer-units/", copy = NA_character_)
df_copy2 <- dockerfile(from = "package_markdown/units/", copy = NA_character_)
expect_false(object = any(sapply(df_copy2@instructions, function(x) { inherits(x, "Copy") })), info = "no Copy instruction")
})

test_that("File copying can be disabled with NULL", {
df_copy <- dockerfile(from = "package_markdown/markdowntainer-units/", copy = NULL)
df_copy <- dockerfile(from = "package_markdown/units/", copy = NULL)
expect_false(object = any(sapply(df_copy@instructions, function(x) { inherits(x, "Copy") })), info = "no Copy instruction")
})

0 comments on commit 1d4190e

Please sign in to comment.