tests/testthat/test-last_stub.R

test_that("last_stub works when no stubs found", {
  stub_registry_clear()

  expect_null(last_stub())
})

test_that("last_stub works when stubs are found", {
  stub_registry_clear()

  stub_request("head", "https://nytimes.com")

  expect_s3_class(last_stub(), "StubbedRequest")
})
ropensci/webmockr documentation built on June 14, 2025, 1:24 p.m.