rack-cache 0.3.0 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rack-cache might be problematic. Click here for more details.

Files changed (44) hide show
  1. data/CHANGES +43 -0
  2. data/README +18 -9
  3. data/Rakefile +1 -14
  4. data/TODO +13 -14
  5. data/doc/configuration.markdown +7 -153
  6. data/doc/faq.markdown +8 -0
  7. data/doc/index.markdown +7 -9
  8. data/example/sinatra/app.rb +25 -0
  9. data/example/sinatra/views/index.erb +44 -0
  10. data/lib/rack/cache.rb +5 -11
  11. data/lib/rack/cache/cachecontrol.rb +193 -0
  12. data/lib/rack/cache/context.rb +190 -52
  13. data/lib/rack/cache/entitystore.rb +10 -4
  14. data/lib/rack/cache/key.rb +52 -0
  15. data/lib/rack/cache/metastore.rb +52 -16
  16. data/lib/rack/cache/options.rb +60 -39
  17. data/lib/rack/cache/request.rb +11 -15
  18. data/lib/rack/cache/response.rb +221 -30
  19. data/lib/rack/cache/storage.rb +1 -2
  20. data/rack-cache.gemspec +9 -15
  21. data/test/cache_test.rb +9 -6
  22. data/test/cachecontrol_test.rb +139 -0
  23. data/test/context_test.rb +251 -169
  24. data/test/entitystore_test.rb +12 -11
  25. data/test/key_test.rb +50 -0
  26. data/test/metastore_test.rb +57 -14
  27. data/test/options_test.rb +11 -0
  28. data/test/request_test.rb +19 -0
  29. data/test/response_test.rb +164 -23
  30. data/test/spec_setup.rb +7 -0
  31. metadata +12 -20
  32. data/doc/events.dot +0 -27
  33. data/lib/rack/cache/config.rb +0 -65
  34. data/lib/rack/cache/config/busters.rb +0 -16
  35. data/lib/rack/cache/config/default.rb +0 -133
  36. data/lib/rack/cache/config/no-cache.rb +0 -13
  37. data/lib/rack/cache/core.rb +0 -299
  38. data/lib/rack/cache/headers.rb +0 -325
  39. data/lib/rack/utils/environment_headers.rb +0 -78
  40. data/test/config_test.rb +0 -66
  41. data/test/core_test.rb +0 -84
  42. data/test/environment_headers_test.rb +0 -69
  43. data/test/headers_test.rb +0 -298
  44. data/test/logging_test.rb +0 -45
data/test/logging_test.rb DELETED
@@ -1,45 +0,0 @@
1
- require "#{File.dirname(__FILE__)}/spec_setup"
2
- require 'rack/cache/context'
3
-
4
- describe "Rack::Cache::Context logging" do
5
-
6
- before(:each) do
7
- respond_with 200
8
- @errors = StringIO.new
9
- @cache = Rack::Cache::Context.new(@app)
10
- @cache.errors = @errors
11
- @cache.metaclass.send :public, :log, :trace, :warn, :info
12
- end
13
-
14
- it 'responds to #log by writing message to #errors' do
15
- @cache.log :test, 'is this thing on?'
16
- @errors.string.should.be == "[cache] test: is this thing on?\n"
17
- end
18
-
19
- it 'allows printf formatting arguments' do
20
- @cache.log :test, '%s %p %i %x', 'hello', 'goodbye', 42, 66
21
- @errors.string.should.be == "[cache] test: hello \"goodbye\" 42 42\n"
22
- end
23
-
24
- it 'responds to #info by logging an :info message' do
25
- @cache.info 'informative stuff'
26
- @errors.string.should.be == "[cache] info: informative stuff\n"
27
- end
28
-
29
- it 'responds to #warn by logging an :warn message' do
30
- @cache.warn 'kinda/maybe bad stuff'
31
- @errors.string.should.be == "[cache] warn: kinda/maybe bad stuff\n"
32
- end
33
-
34
- it 'responds to #trace by logging a :trace message' do
35
- @cache.trace 'some insignifacant event'
36
- @errors.string.should.be == "[cache] trace: some insignifacant event\n"
37
- end
38
-
39
- it "doesn't log trace messages when not in verbose mode" do
40
- @cache.verbose = false
41
- @cache.trace 'some insignifacant event'
42
- @errors.string.should.be == ""
43
- end
44
-
45
- end