rtomayko-rack-cache 0.3.0 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
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