instiki/vendor/plugins/rack/test/spec_rack_commonlogger.rb
Jacques Distler 4e14ccc74d Instiki 0.16.3: Rails 2.3.0
Instiki now runs on the Rails 2.3.0 Candidate Release.
Among other improvements, this means that it now 
automagically selects between WEBrick and Mongrel.

Just run

    ./instiki --daemon
2009-02-04 14:26:08 -06:00

33 lines
773 B
Ruby

require 'test/spec'
require 'stringio'
require 'rack/commonlogger'
require 'rack/lobster'
require 'rack/mock'
context "Rack::CommonLogger" do
app = lambda { |env|
[200,
{"Content-Type" => "text/html"},
["foo"]]}
specify "should log to rack.errors by default" do
log = StringIO.new
res = Rack::MockRequest.new(Rack::CommonLogger.new(app)).get("/")
res.errors.should.not.be.empty
res.errors.should =~ /GET /
res.errors.should =~ / 200 / # status
res.errors.should =~ / 3 / # length
end
specify "should log to anything with <<" do
log = ""
res = Rack::MockRequest.new(Rack::CommonLogger.new(app, log)).get("/")
log.should =~ /GET /
log.should =~ / 200 / # status
log.should =~ / 3 / # length
end
end