Sha256: c61c1b317cad096d6669c3fb2e5c25c4ed27dba673838bb6654491734de37dad

Contents?: true

Size: 773 Bytes

Versions: 55

Compression:

Stored size: 773 Bytes

Contents

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

Version data entries

55 entries across 55 versions & 13 rubygems

Version Path
relevance-castronaut-0.5.2 vendor/rack/test/spec_rack_commonlogger.rb
relevance-castronaut-0.5.3 vendor/rack/test/spec_rack_commonlogger.rb
relevance-castronaut-0.5.4 vendor/rack/test/spec_rack_commonlogger.rb
relevance-castronaut-0.6.0 vendor/rack/test/spec_rack_commonlogger.rb
relevance-castronaut-0.6.1 vendor/rack/test/spec_rack_commonlogger.rb
relevance-castronaut-0.7.4 vendor/rack/test/spec_rack_commonlogger.rb
relevance-castronaut-0.7.5 vendor/rack/test/spec_rack_commonlogger.rb
technomancy-rack-0.3.0 test/spec_rack_commonlogger.rb
timocratic-rack-1.0.0 test/spec_rack_commonlogger.rb
nbudin-castronaut-0.7.5 vendor/rack/test/spec_rack_commonlogger.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_commonlogger.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_commonlogger.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_commonlogger.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_commonlogger.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rack-0.4.0/test/spec_rack_commonlogger.rb
middleman-0.12.2 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_commonlogger.rb
middleman-0.12.1 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_commonlogger.rb
middleman-0.12.0.pre3 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_commonlogger.rb
middleman-0.12.0.pre2 lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_commonlogger.rb
middleman-0.12.0.pre lib/middleman/vendor/gems/gems/rack-1.0.1/test/spec_rack_commonlogger.rb