kubo39/bossan — pull request #13 by rnakano (2013-08-03 07:10:39+00:00)
Title: Refactoring tests, add Bossan::Test::TestCase.

There are some tests in test/ directory, however all tests include below part:

begin
$stderr.puts RUBY_DESCRIPTION
pid = fork do
trap(:INT) { Bossan.stop }
Bossan.listen(DEFAULT_HOST, DEFAULT_PORT)
Bossan.run(App.new)
end

Process.detach pid

unless server_is_wake_up?
$stderr.puts "bossan won't wake up until you love it ..."
exit 1
end

err = MiniTest::Unit.new.run(ARGV)
exit false if err && err != 0

ensure
Process.kill(:INT, pid)
end

This patch refactors tests, it moves server start/stop codes to test/bossan_test.rb
We can use Bossan::Test::TestCase instead of Test::Unit::TestCase. It automatically starts/stops server each tests.

And, add test endpoint test/driver.rb, so `rake test` simply kick it.