Sha256: f31e5c24731d866244dd0d91a7881855687388610434a805e39d98f332614b2f

Contents?: true

Size: 563 Bytes

Versions: 11

Compression:

Stored size: 563 Bytes

Contents

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

Version data entries

11 entries across 10 versions & 5 rubygems

Version Path
vanity-1.7.1 vendor/ruby/1.9.1/gems/rack-1.1.2/test/spec_rack_logger.rb
rack-1.1.2 test/spec_rack_logger.rb
rack-1.1.1 test/spec_rack_logger.rb
rack-1.1.1.pre test/spec_rack_logger.rb
eac-rack-1.1.1 test/spec_rack_logger.rb
akamai_bookmarklet-0.1.2 vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_logger.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.9.1/gems/rack-1.1.0/test/spec_rack_logger.rb
middleman-0.13.1 lib/middleman/vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_logger.rb
akamai_bookmarklet-0.1.1 vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_logger.rb
akamai_bookmarklet-0.1.0 vendor/gems/ruby/1.8/gems/rack-1.1.0/test/spec_rack_logger.rb
rack-1.1.0 test/spec_rack_logger.rb