silence logs in server_test.rb again

Conflicts:

	test/server_test.rb
This commit is contained in:
Konstantin Haase 2011-06-16 14:02:52 +02:00
parent 16b02beb68
commit ab221cc646
2 changed files with 6 additions and 5 deletions

View File

@ -1171,7 +1171,7 @@ module Sinatra
def quit!(server, handler_name)
# Use Thin's hard #stop! if available, otherwise just #stop.
server.respond_to?(:stop!) ? server.stop! : server.stop
STDERR.puts "\n== Sinatra has ended his set (crowd applauds)" unless handler_name =~/cgi/i
$stderr.puts "\n== Sinatra has ended his set (crowd applauds)" unless handler_name =~/cgi/i
end
# Run the Sinatra app as a self-hosted server using
@ -1180,14 +1180,14 @@ module Sinatra
set options
handler = detect_rack_handler
handler_name = handler.name.gsub(/.*::/, '')
STDERR.puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
$stderr.puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
"on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i
handler.run self, :Host => bind, :Port => port do |server|
[:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
set :running, true
end
rescue Errno::EADDRINUSE => e
STDERR.puts "== Someone is already performing on port #{port}!"
$stderr.puts "== Someone is already performing on port #{port}!"
end
# The prototype instance used to process requests.

View File

@ -1,4 +1,5 @@
require File.expand_path('../helper', __FILE__)
require 'stringio'
module Rack::Handler
class Mock
@ -25,11 +26,11 @@ class ServerTest < Test::Unit::TestCase
set :bind, 'foo.local'
set :port, 9001
}
$stdout = File.open('/dev/null', 'wb')
$stderr = StringIO.new
end
def teardown
$stdout = STDOUT
$stderr = STDERR
end
it "locates the appropriate Rack handler and calls ::run" do