Sha256: b854a0c6419ad5a150ff1403bdbca03eb37be0c2b898a3f1b7c52fafd13d5a29

Contents?: true

Size: 727 Bytes

Versions: 6

Compression:

Stored size: 727 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

6 entries across 6 versions & 1 rubygems

Version Path
radiant-0.6.5.1 test/helpers/caching_test_helper.rb
radiant-0.6.5 test/helpers/caching_test_helper.rb
radiant-0.6.7 test/helpers/caching_test_helper.rb
radiant-0.6.6 test/helpers/caching_test_helper.rb
radiant-0.6.8 test/helpers/caching_test_helper.rb
radiant-0.6.9 test/helpers/caching_test_helper.rb