VCR
Inherits Habitat::SettingsHelpers < Habitat::TempConfig
TODO: Write documentation for VCR
Constants
HABITAT_SETTINGS = [{decl: cassette_library_dir : String = "spec/fixtures/vcr",
example: nil, validation: nil}] of Nil
VERSION = "0.2.2"
Class methods
configure
Sourcesettings
SourceInstance methods
settings
Sourceuse_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