module VCR
Overview
TODO Write documentation for VCR
Included Modules
- Habitat::SettingsHelpers
- Habitat::TempConfig
Extended Modules
Defined in:
vcr.crvcr/methods.cr
vcr/version.cr
Constant Summary
-
HABITAT_SETTINGS =
[{decl: cassette_library_dir : String = "spec/fixtures/vcr", example: nil, validation: nil}, {decl: filter_sensitive_data : Hash(String, String) = Hash(String, String).new, example: nil, validation: nil}] of Nil
-
VERSION =
"0.5.2"
Class Method Summary
Instance Method Summary
- #cassette_dir
-
#cassette_name
The name of the cassette
- #filter_sensitive_data(param_name : String, placeholder : String)
- #filter_sensitive_data!(request : HTTP::Request) : HTTP::Request
-
#in_order?
Returns true if the casset should record requests in order
-
#sequence
The current sequence, calling this will increment the value
- #settings
-
#use_cassette(cassette_name : String, *args, &block)
Defines the cassette to load for recording.
- #use_cassette(cassette_name : String, *args)
Class Method Detail
Instance Method Detail
def use_cassette(cassette_name : String, *args, &block)
#
Defines the cassette to load for recording. Optional arguments can also be passed.
Options:
:record
- will delete any VCR files in this cassette so new ones can be generated:in_order
- will record requests in order (allows multiple records of the same request). Should be used when you expect the result to be different on a second request
Example:
VCR.use_cassette("cassette-one") do
r1 = HTTP::Client.get("https://jsonplaceholder.typicode.com/todos")
end
Record new responses, in order, so i can verify the delete worked
VCR.use_cassette("cassette-one", :record, :in_order) do
r1 = HTTP::Client.get("https://jsonplaceholder.typicode.com/todos")
HTTP::Client.delete("https://jsonplaceholder.typicode.com/todos/1")
r2 = HTTP::Client.get("https://jsonplaceholder.typicode.com/todos")
end