a705709f9a
Also clean up some View stuff.
22 lines
563 B
Ruby
22 lines
563 B
Ruby
require 'rack/logger'
|
|
require 'rack/lint'
|
|
require 'stringio'
|
|
|
|
context "Rack::Logger" do
|
|
specify "logs to rack.errors" do
|
|
app = lambda { |env|
|
|
log = env['rack.logger']
|
|
log.debug("Created logger")
|
|
log.info("Program started")
|
|
log.warn("Nothing to do!")
|
|
|
|
[200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]]
|
|
}
|
|
|
|
errors = StringIO.new
|
|
Rack::Logger.new(app).call({'rack.errors' => errors})
|
|
errors.string.should.match "INFO -- : Program started"
|
|
errors.string.should.match "WARN -- : Nothing to do"
|
|
end
|
|
end
|