inst/tmp/_test_from_year_to_year.mock.R

library(testthat)
library(stubthat)

context("mock test of from_year to to_year")

check_search <- function(query, from_year, to_year, how) {
    response <- make_search_url(query = "neural network",
                                from_year = 1990,
                                to_year   = 2000,
                                how = "all")
    response_status <- 510
}


make_search_url_stub <- stub(make_search_url)

check_search_tester <- function(query, from_year, to_year, how) {
    mockr::with_mock(make_search_url = make_search_url_stub$f,
                     check_search(query, from_year, to_year, how))
}


expect_equal(check_search_tester(query = "neural network",
                                 from_year = 1990,
                                 to_year   = 2000,
                                 how = "all"), 510)

Try the petro.One package in your browser

Any scripts or data that you put into this service are public.

petro.One documentation built on May 2, 2019, 3:10 p.m.