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")
})
ropenscilabs/webmockr documentation built on Feb. 12, 2025, 2:53 a.m.