Permalink
Browse files

silence logs in server_test.rb again

Conflicts:

	test/server_test.rb
  • Loading branch information...
rkh committed Jun 16, 2011
1 parent 16b02be commit ab221cc6467d1c5c337a73252892f1b72ca0652d
Showing with 6 additions and 5 deletions.
  1. +3 −3 lib/sinatra/base.rb
  2. +3 −2 test/server_test.rb
View
@@ -1171,7 +1171,7 @@ def use(middleware, *args, &block)
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 @@ def run!(options={})
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
@@ -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

0 comments on commit ab221cc

Please sign in to comment.