Skip to contents

Eject a cassette

Usage

eject_cassette(
  cassette = NULL,
  options = list(),
  skip_no_unused_interactions_assertion = NULL
)

Arguments

cassette

(character) a single cassette names to eject; see name parameter definition in insert_cassette() for cassette name rules

options

(list) a list of options to apply to the eject process

skip_no_unused_interactions_assertion

(logical) If TRUE, this will skip the "no unused HTTP interactions" assertion enabled by the allow_unused_http_interactions = FALSE cassette option. This is intended for use when your test has had an error, but your test framework has already handled it - IGNORED FOR NOW

Value

The ejected cassette if there was one

Examples

vcr_configure(dir = tempdir())
#> <vcr configuration>
#>   Cassette Dir: /tmp/RtmpV0XHMo
#>   Record: once
#>   Serialize with: yaml
#>   URI Parser: crul::url_parse
#>   Match Requests on: method, uri
#>   Preserve Bytes?: FALSE
#>   Logging?: FALSE
#>   ignored hosts: 
#>   ignore localhost?: FALSE
#>   Write disk path: 
insert_cassette("hello")
#> <vcr - Cassette> hello
#>   Record method: once
#>   Serialize with: yaml
#>   Persist with: FileSystem
#>   Re-record interval (s): 
#>   Clean outdated interactions?: FALSE
#>   update_content_length_header: FALSE
#>   allow_playback_repeats: FALSE
#>   allow_unused_http_interactions: 
#>   exclusive: 
#>   preserve_exact_body_bytes: FALSE
(x <- current_cassette())
#> <vcr - Cassette> hello
#>   Record method: once
#>   Serialize with: yaml
#>   Persist with: FileSystem
#>   Re-record interval (s): 
#>   Clean outdated interactions?: FALSE
#>   update_content_length_header: FALSE
#>   allow_playback_repeats: FALSE
#>   allow_unused_http_interactions: 
#>   exclusive: 
#>   preserve_exact_body_bytes: FALSE

# by default does current cassette
x <- eject_cassette()
#> Warning: Empty cassette (hello) deleted; consider the following:
#>  - If an error occurred resolve that first, then check:
#>  - vcr only supports crul, httr & httr2; requests w/ curl, download.file, etc. are not supported
#>  - If you are using crul/httr/httr2, are you sure you made an HTTP request?
#> net connect disabled
x
#> <vcr - Cassette> hello
#>   Record method: once
#>   Serialize with: yaml
#>   Persist with: FileSystem
#>   Re-record interval (s): 
#>   Clean outdated interactions?: FALSE
#>   update_content_length_header: FALSE
#>   allow_playback_repeats: FALSE
#>   allow_unused_http_interactions: 
#>   exclusive: 
#>   preserve_exact_body_bytes: FALSE
# can also select by cassette name
# eject_cassette(cassette = "hello")