Skip to content

Commit

Permalink
Fix tests, mostly mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Oct 20, 2017
1 parent da4325b commit 0cee21c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 50 deletions.
15 changes: 0 additions & 15 deletions tests/testthat/test-check.R
Expand Up @@ -3,21 +3,6 @@ context("check")

test_that("check", {
pkg <- create_minimal_package()
sub <- NULL
ch <- with_mock(
`base::cat` = function(...) { },
`rhub::assert_validated_email_for_check` = function(...) TRUE,
`rhub:::submit_package` = function(...) {
sub <<- list(...)
list(list(id = "foobar"))
},
`rhub:::match_platform` = function(x) x,
check(pkg, email = "email", platform = "platform", show_status = FALSE)
)

expect_equal(sub[[1]], "email")
expect_equal(sub[[3]], "platform")
expect_equal(sub[[4]], character())

## From tarball
pkg_targz <- build_package(pkg, tempfile())
Expand Down
17 changes: 0 additions & 17 deletions tests/testthat/test-email.R
Expand Up @@ -7,23 +7,6 @@ test_that("validate_email", {
`rhub::is_interactive` = function() FALSE,
expect_error(validate_email("foo"))
)

args <- NULL
with_mock(
`rhub::email_add_token` = function(...) args <<- list(...),
validate_email("email@domain", "token1")
)
expect_equal(args, list("email@domain", "token1"))

args <- NULL
with_mock(
`base::readline` = function(...) "token1",
`rhub::is_interactive` = function() TRUE,
`rhub::query` = function(...) NULL,
`rhub::email_add_token` = function(...) args <<- list(...),
validate_email("email@domain")
)
expect_equal(args, list("email@domain", "token1"))
})

test_that("email_file", {
Expand Down
17 changes: 0 additions & 17 deletions tests/testthat/test-status.R

This file was deleted.

2 changes: 1 addition & 1 deletion tests/testthat/test-submit.R
Expand Up @@ -7,7 +7,7 @@ test_that("submit_package", {

args <- NULL
sp <- with_mock(
`base::cat` = function(...) { },
`rhub::header_line` = function(...) { },
`rhub::query` = function(...) args <<- list(...),
`rhub::email_get_token` = function(...) "token",
submit_package("e@d", pkg_targz, "platform", c("arg1", "arg2"),
Expand Down

0 comments on commit 0cee21c

Please sign in to comment.