Skip to content

Commit b826f3b

Browse files
committed
remove dontrun for webmockr opts and mocking disk writing egs
1 parent bd0cd11 commit b826f3b

File tree

4 files changed

+24
-18
lines changed

4 files changed

+24
-18
lines changed

R/mocking-disk-writing.R

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#' Mocking writing to disk
22
#'
33
#' @name mocking-disk-writing
4-
#' @examples \dontrun{
4+
#' @examples
55
#' # enable mocking
66
#' enable()
7-
#' # getOption('httr2_mock')
87
#'
9-
#' # Write to a file before mocked request
8+
#' # Write to a file before mocked request -------------
109
#'
1110
#' # crul
1211
#' library(crul)
@@ -22,6 +21,7 @@
2221
#' (out <- HttpClient$new("https://httpbin.org/get")$get(disk = f))
2322
#' out$content
2423
#' readLines(out$content)
24+
#' stub_registry_clear()
2525
#'
2626
#' # httr
2727
#' library(httr)
@@ -42,6 +42,7 @@
4242
#' out
4343
#' out$content
4444
#' content(out, "text", encoding = "UTF-8")
45+
#' stub_registry_clear()
4546
#'
4647
#' # httr2
4748
#' library(httr2)
@@ -61,12 +62,11 @@
6162
#' out <- req_perform(req, path = f)
6263
#' out
6364
#' out$body
64-
#' out
6565
#' out$headers
6666
#' readLines(out$body)
67+
#' stub_registry_clear()
6768
#'
68-
#'
69-
#' # Use mock_file to have webmockr handle file and contents
69+
#' # Use mock_file to have webmockr handle file and contents -------------
7070
#'
7171
#' # crul
7272
#' library(crul)
@@ -78,6 +78,7 @@
7878
#' (out <- crul::HttpClient$new("https://httpbin.org/get")$get(disk = f))
7979
#' out$content
8080
#' readLines(out$content)
81+
#' stub_registry_clear()
8182
#'
8283
#' # httr
8384
#' library(httr)
@@ -96,6 +97,7 @@
9697
#' out$content
9798
#' readLines(out$content)
9899
#' content(out, "text", encoding = "UTF-8")
100+
#' stub_registry_clear()
99101
#'
100102
#' # httr2
101103
#' library(httr2)
@@ -114,8 +116,8 @@
114116
#' ## view stubbed file content
115117
#' out$body
116118
#' readLines(out$body)
119+
#' stub_registry_clear()
117120
#'
118121
#' # disable mocking
119122
#' disable()
120-
#' }
121123
NULL

R/webmockr-opts.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#' response will be returned. If no stub is found, and net connections
2222
#' are allowed, then a real HTTP request can be made.
2323
#'
24-
#' @examples \dontrun{
24+
#' @examples
2525
#' webmockr_configure()
2626
#' webmockr_configure(
2727
#' allow_localhost = TRUE
@@ -43,7 +43,9 @@
4343
#'
4444
#' # show body diff
4545
#' webmockr_configure(show_body_diff = TRUE)
46-
#' }
46+
#'
47+
#' # cleanup
48+
#' webmockr_configure_reset()
4749
webmockr_configure <- function(
4850
allow_net_connect = FALSE,
4951
allow_localhost = FALSE,

man/mocking-disk-writing.Rd

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/webmockr_configure.Rd

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)