Sha256: d7c8fe9fcb3257ada3bbefaa6fa59ef1e4f1ed5c15eefd13047ac6a6838df914

Contents?: true

Size: 540 Bytes

Versions: 3

Compression:

Stored size: 540 Bytes

Contents

require 'stringio'
require 'rack/logger'

describe Rack::Logger do
  should "log 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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-1.2.2 test/spec_logger.rb
rack-1.2.1 test/spec_logger.rb
rack-1.2.0 spec/spec_logger.rb