Class VCR::Cassette
In: lib/vcr/cassette/http_interaction_list.rb
lib/vcr/cassette/erb_renderer.rb
lib/vcr/cassette/persisters.rb
lib/vcr/cassette/serializers/compressed.rb
lib/vcr/cassette/serializers/json.rb
lib/vcr/cassette/serializers/psych.rb
lib/vcr/cassette/serializers/syck.rb
lib/vcr/cassette/serializers/yaml.rb
lib/vcr/cassette/persisters/file_system.rb
lib/vcr/cassette/migrator.rb
lib/vcr/cassette/serializers.rb
lib/vcr/cassette.rb
Parent: Object

The media VCR uses to store HTTP interactions for later re-use.

Methods

Included Modules

Logger::Mixin

Classes and Modules

Module VCR::Cassette::EncodingErrorHandling
Class VCR::Cassette::ERBRenderer
Class VCR::Cassette::HTTPInteractionList
Class VCR::Cassette::Migrator
Class VCR::Cassette::Persisters
Class VCR::Cassette::Serializers

Constants

VALID_RECORD_MODES = [:all, :none, :new_episodes, :once]   The supported record modes.
  * :all -- Record every HTTP interactions; do not play any back.
  * :none -- Do not record any HTTP interactions; play them back.
  * :new_episodes -- Playback previously recorded HTTP interactions and record new ones.
  * :once -- Record the HTTP interactions if the cassette has not already been recorded;
             otherwise, playback the HTTP interactions.

Attributes

erb  [R]  @return [Boolean, Hash] The cassette‘s ERB option. The file will be treated as an
 ERB template if this has a truthy value. A hash, if provided, will be used as local
 variables for the ERB template.
match_requests_on  [R]  @return [Array<Symbol, call>] List of request matchers. Used to find a response from an
 existing HTTP interaction to play back.
name  [R]  @return [to_s] The name of the cassette. Used to determine the cassette‘s file name. @see file
re_record_interval  [R]  @return [Integer, nil] How frequently (in seconds) the cassette should be re-recorded.
record_mode  [R]  @return [Symbol] The record mode. Determines whether the cassette records HTTP interactions,
 plays them back, or does both.
tags  [R]  @return [Array<Symbol>] If set, {VCR::Configuration#before_record} and
 {VCR::Configuration#before_playback} hooks with a corresponding tag will apply.

Public Class methods

Public Instance methods

Ejects the current cassette. The cassette will no longer be used. In addition, any newly recorded HTTP interactions will be written to disk.

@note This is not intended to be called directly. Use `VCR.eject_cassette` instead.

@param (see VCR#eject_casssette) @see VCR#eject_cassette

@return [String] The file for this cassette. @raise [NotImplementedError] if the configured cassette persister

 does not support resolving file paths.

@note VCR will take care of sanitizing the cassette name to make it a valid file name.

@return [Boolean] false unless wrapped with LinkedCassette

@return [Time, nil] The `recorded_at` time of the first HTTP interaction

                    or nil if the cassette has no prior HTTP interactions.

@example

  VCR.use_cassette("some cassette") do |cassette|
    Timecop.freeze(cassette.originally_recorded_at || Time.now) do
      # ...
    end
  end

@return [Boolean] Whether or not the cassette is recording.

@return [Hash] The hash that will be serialized when the cassette is written to disk.

[Validate]