request_test.rb 709 B

12345678910111213141516171819
  1. require "#{File.dirname(__FILE__)}/spec_setup"
  2. require 'rack/cache/request'
  3. describe 'Rack::Cache::Request' do
  4. it 'is marked as no_cache when the Cache-Control header includes the no-cache directive' do
  5. request = Rack::Cache::Request.new('HTTP_CACHE_CONTROL' => 'public, no-cache')
  6. request.should.be.no_cache
  7. end
  8. it 'is marked as no_cache when request should not be loaded from cache' do
  9. request = Rack::Cache::Request.new('HTTP_PRAGMA' => 'no-cache')
  10. request.should.be.no_cache
  11. end
  12. it 'is not marked as no_cache when neither no-cache directive is specified' do
  13. request = Rack::Cache::Request.new('HTTP_CACHE_CONTROL' => 'public')
  14. request.should.not.be.no_cache
  15. end
  16. end