From 6473c351009996a3be0f044d21ea795cf574e1ab Mon Sep 17 00:00:00 2001 From: Javier Julio Date: Fri, 27 Feb 2026 19:09:42 -0500 Subject: [PATCH] Drop test-unit dependency with migrated test This was the only test case still written using test-unit but now converted we can safely remove the test-unit dependency. --- clockwork.gemspec | 1 - test/signal_test.rb | 32 +++++++++++++++----------------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/clockwork.gemspec b/clockwork.gemspec index db90de4..529d247 100644 --- a/clockwork.gemspec +++ b/clockwork.gemspec @@ -27,5 +27,4 @@ Gem::Specification.new do |s| s.add_development_dependency "daemons" s.add_development_dependency "minitest", "~> 5.8" s.add_development_dependency "mocha" - s.add_development_dependency "test-unit" end diff --git a/test/signal_test.rb b/test/signal_test.rb index 76f9b6d..eb2db04 100644 --- a/test/signal_test.rb +++ b/test/signal_test.rb @@ -1,34 +1,32 @@ -require 'test/unit' +require "minitest/autorun" require 'mocha/minitest' require 'fileutils' -class SignalTest < Test::Unit::TestCase - CMD = File.expand_path('../../bin/clockwork', __FILE__) - SAMPLE = File.expand_path('../samples/signal_test.rb', __FILE__) - LOGFILE = File.expand_path('../tmp/signal_test.log', __FILE__) - - setup do - FileUtils.mkdir_p(File.dirname(LOGFILE)) - @pid = spawn(CMD, SAMPLE) - until File.exist?(LOGFILE) +describe "SignalTest" do + before do + @command = File.expand_path('../../bin/clockwork', __FILE__) + @sample = File.expand_path('../samples/signal_test.rb', __FILE__) + @logfile = File.expand_path('../tmp/signal_test.log', __FILE__) + FileUtils.mkdir_p(File.dirname(@logfile)) + @pid = spawn(@command, @sample) + until File.exist?(@logfile) sleep 0.1 end end - teardown do - FileUtils.rm_r(File.dirname(LOGFILE)) + after do + FileUtils.rm_r(File.dirname(@logfile)) end - test 'should gracefully shutdown with SIGTERM' do + it 'should gracefully shutdown with SIGTERM' do Process.kill(:TERM, @pid) sleep 0.2 - assert_equal 'done', File.read(LOGFILE) + assert_equal 'done', File.read(@logfile) end - test 'should forcely shutdown with SIGINT' do + it 'should forcely shutdown with SIGINT' do Process.kill(:INT, @pid) sleep 0.2 - assert_equal 'start', File.read(LOGFILE) + assert_equal 'start', File.read(@logfile) end end -