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.
- data/CHANGES +43 -0
- data/README +18 -9
- data/Rakefile +1 -14
- data/TODO +13 -14
- data/doc/configuration.markdown +7 -153
- data/doc/faq.markdown +8 -0
- data/doc/index.markdown +7 -9
- data/example/sinatra/app.rb +25 -0
- data/example/sinatra/views/index.erb +44 -0
- data/lib/rack/cache.rb +5 -11
- data/lib/rack/cache/cachecontrol.rb +193 -0
- data/lib/rack/cache/context.rb +190 -52
- data/lib/rack/cache/entitystore.rb +10 -4
- data/lib/rack/cache/key.rb +52 -0
- data/lib/rack/cache/metastore.rb +52 -16
- data/lib/rack/cache/options.rb +60 -39
- data/lib/rack/cache/request.rb +11 -15
- data/lib/rack/cache/response.rb +221 -30
- data/lib/rack/cache/storage.rb +1 -2
- data/rack-cache.gemspec +9 -15
- data/test/cache_test.rb +9 -6
- data/test/cachecontrol_test.rb +139 -0
- data/test/context_test.rb +251 -169
- data/test/entitystore_test.rb +12 -11
- data/test/key_test.rb +50 -0
- data/test/metastore_test.rb +57 -14
- data/test/options_test.rb +11 -0
- data/test/request_test.rb +19 -0
- data/test/response_test.rb +164 -23
- data/test/spec_setup.rb +7 -0
- metadata +12 -20
- data/doc/events.dot +0 -27
- data/lib/rack/cache/config.rb +0 -65
- data/lib/rack/cache/config/busters.rb +0 -16
- data/lib/rack/cache/config/default.rb +0 -133
- data/lib/rack/cache/config/no-cache.rb +0 -13
- data/lib/rack/cache/core.rb +0 -299
- data/lib/rack/cache/headers.rb +0 -325
- data/lib/rack/utils/environment_headers.rb +0 -78
- data/test/config_test.rb +0 -66
- data/test/core_test.rb +0 -84
- data/test/environment_headers_test.rb +0 -69
- data/test/headers_test.rb +0 -298
- 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
|