Class VCR::Middleware::Rack
In: lib/vcr/middleware/rack.rb
Parent: Object

Rack middleware that uses a VCR cassette for each incoming HTTP request.

@example

  app = Rack::Builder.new do
    use VCR::Middleware::Rack do |cassette, env|
      cassette.name "rack/#{env['SERVER_NAME']}"
      cassette.options :record => :new_episodes
    end

    run MyRackApp
  end

@note This will record/replay outbound HTTP requests made by your rack app.

Methods

call   new  

Included Modules

VCR::VariableArgsBlockCaller

Public Class methods

Constructs a new instance of VCR‘s rack middleware.

@param [call] app the rack app @yield the cassette configuration block @yieldparam [CassetteArguments] cassette the cassette configuration object @yieldparam [(optional) Hash] env the rack env hash @raise [ArgumentError] if no configuration block is provided

Public Instance methods

Implements the rack middleware interface.

@param [Hash] env the rack env hash @return [Array(Integer, Hash, each)] the rack response

[Validate]