silence logs in server_test.rb again
Conflicts: test/server_test.rb
This commit is contained in:
parent
16b02beb68
commit
ab221cc646
|
@ -1171,7 +1171,7 @@ module Sinatra
|
||||||
def quit!(server, handler_name)
|
def quit!(server, handler_name)
|
||||||
# Use Thin's hard #stop! if available, otherwise just #stop.
|
# Use Thin's hard #stop! if available, otherwise just #stop.
|
||||||
server.respond_to?(:stop!) ? server.stop! : server.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
|
end
|
||||||
|
|
||||||
# Run the Sinatra app as a self-hosted server using
|
# Run the Sinatra app as a self-hosted server using
|
||||||
|
@ -1180,14 +1180,14 @@ module Sinatra
|
||||||
set options
|
set options
|
||||||
handler = detect_rack_handler
|
handler = detect_rack_handler
|
||||||
handler_name = handler.name.gsub(/.*::/, '')
|
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
|
"on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i
|
||||||
handler.run self, :Host => bind, :Port => port do |server|
|
handler.run self, :Host => bind, :Port => port do |server|
|
||||||
[:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
|
[:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
|
||||||
set :running, true
|
set :running, true
|
||||||
end
|
end
|
||||||
rescue Errno::EADDRINUSE => e
|
rescue Errno::EADDRINUSE => e
|
||||||
STDERR.puts "== Someone is already performing on port #{port}!"
|
$stderr.puts "== Someone is already performing on port #{port}!"
|
||||||
end
|
end
|
||||||
|
|
||||||
# The prototype instance used to process requests.
|
# The prototype instance used to process requests.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
require File.expand_path('../helper', __FILE__)
|
require File.expand_path('../helper', __FILE__)
|
||||||
|
require 'stringio'
|
||||||
|
|
||||||
module Rack::Handler
|
module Rack::Handler
|
||||||
class Mock
|
class Mock
|
||||||
|
@ -25,11 +26,11 @@ class ServerTest < Test::Unit::TestCase
|
||||||
set :bind, 'foo.local'
|
set :bind, 'foo.local'
|
||||||
set :port, 9001
|
set :port, 9001
|
||||||
}
|
}
|
||||||
$stdout = File.open('/dev/null', 'wb')
|
$stderr = StringIO.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
$stdout = STDOUT
|
$stderr = STDERR
|
||||||
end
|
end
|
||||||
|
|
||||||
it "locates the appropriate Rack handler and calls ::run" do
|
it "locates the appropriate Rack handler and calls ::run" do
|
||||||
|
|
Loading…
Reference in New Issue