Skip to content

Commit

Permalink
improve test
Browse files Browse the repository at this point in the history
if 404, try again
  • Loading branch information
achubaty committed Dec 8, 2016
1 parent d1c6a3f commit e310fae
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Package: meow
Type: Package
Title: Get Random Pictures of Cats
Description: Queries http://thecatapi.com for cute cat photos and displays them in yor R session. Meow!
Version: 0.1.3
Date: 2015-05-13
Version: 0.1.4
Date: 2016-12-08
Authors@R: c(
person(c("Alex", "M"), "Chubaty",
email="[email protected]",
Expand Down
9 changes: 5 additions & 4 deletions R/meow.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# meow by Alex M Chubaty and Kiri Whan
# Copyright (C) 2015
# Copyright (C) 2015-2016
#


Expand Down Expand Up @@ -47,10 +47,11 @@ meow <- function() {

# download and plot the cat
tmp <- tempfile()
dl_status <- download.file(url, tmp, quiet=TRUE, mode="wb")
dl_status <- download.file(url, tmp, quiet = TRUE, mode = "wb")

pic <- jpeg::readJPEG(tmp)
plot(1, type="n", xlim=c(0, 1), ylim=c(0, 1), bty="n", xaxt="n", yaxt="n",
xlab="", ylab="")
plot(1, type = "n", xlim = c(0, 1), ylim = c(0, 1), bty = "n",
xaxt = "n", yaxt = "n", xlab = "", ylab = "")
graphics::rasterImage(pic, 0, 0, 1, 1)
rm_status <- file.remove(tmp)

Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-meow.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test_that("test meow success", {
expect_true(meow())
success <- suppressWarnings(tryCatch(meow(), error = function(e) meow()))
expect_true(success)
})

0 comments on commit e310fae

Please sign in to comment.