Sha256: 36be0ad9c1fa74658045b3ab2da5db2eb771a0336cb6b643bb162be832cdc824

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

class FakeResponseCache
  attr_accessor :expired_path, :expired_paths

  def initialize
    @expired_paths = []
    @cached_responses = {}
  end

  def clear
    @cached_responses.clear
    @cleared = true
  end

  def cache_response(path, response)
    @cached_responses[path] = response
    response
  end

  def update_response(path, response)
    if r = @cached_response[path]
      response.headers.merge!(r.headers)
      response.body = r.body
    end
    response
  end

  def expire_response(path)
    @expired_paths << path
    @expired_path = path
  end

  def response_cached?(path)
    @cached_responses.keys.include?(path)
  end

  def cleared?
    !!@cleared
  end
end

module CachingTestHelper
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-concurrent_draft-extension-1.0.1 test/helpers/caching_test_helper.rb
radiant-concurrent_draft-extension-1.0.0 test/helpers/caching_test_helper.rb