You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -81,7 +81,7 @@ This will:
81
81
* setup a config file for `vcr`
82
82
* add an example test file for `vcr`
83
83
* make a `.gitattributes` file with settings for `vcr`
84
-
* make a `./tests/testthat/setup-vcr.R` file
84
+
* make a `./tests/testthat/helper-vcr.R` file
85
85
86
86
What you will see in the R console:
87
87
@@ -92,7 +92,7 @@ What you will see in the R console:
92
92
✓ Creating directory: ./tests/testthat
93
93
◉ Looking for testthat.R file or similar
94
94
✓ tests/testthat.R: added
95
-
✓ Adding vcr config to tests/testthat/setup-vcr.example.R
95
+
✓ Adding vcr config to tests/testthat/helper-vcr.example.R
96
96
✓ Adding example test file tests/testthat/test-vcr_example.R
97
97
✓ .gitattributes: added
98
98
◉ Learn more about `vcr`: https://books.ropensci.org/http-testing
@@ -104,7 +104,7 @@ Secrets often turn up in API work. A common example is an API key.
104
104
`vcr` saves responses from APIs as YAML files, and this will include your secrets unless you indicate to `vcr` what they are and how to protect them.
105
105
The `vcr_configure` function has the `filter_sensitive_data` argument function for just this situation.
106
106
The `filter_sensitive_data` argument takes a named list where the _name_ of the list is the string that will be used in the recorded cassettes _instead of_ the secret, which is the list _item_.
107
-
`vcr` will manage the replacement of that for you, so all you need to do is to edit your `setup-vcr.R` file like this:
107
+
`vcr` will manage the replacement of that for you, so all you need to do is to edit your [`helper-vcr.R` file](https://testthat.r-lib.org/reference/test_dir.html#special-files) like this:
108
108
109
109
```r
110
110
library("vcr") # *Required* as vcr is set up on loading
@@ -152,7 +152,7 @@ Furthermore, as by default requests matching does not include the API key, thing
152
152
E.g. to have tests pass on continuous integration for external pull requests to your code repository.
153
153
154
154
* vcr does not need an actual API key for requests once the cassettes are created, as no real requests will be made.
155
-
* you still need to fool your _package_ into believing there is an API key as it will construct requests with it. So add the following lines to a testthat setup file (e.g. `tests/testthat/setup-vcr.R`)
155
+
* you still need to fool your _package_ into believing there is an API key as it will construct requests with it. So add the following lines to a testthat setup file (e.g. `tests/testthat/helper-vcr.R`)
156
156
157
157
```r
158
158
if (!nzchar(Sys.getenv("APIKEY"))) {
@@ -470,6 +470,7 @@ We've tried to make sure the parameters that are ignored are marked as such. Kee
0 commit comments