Skip to content

Commit eac1064

Browse files
authored
Drop test-unit dependency with migrated test (#93)
This was the only test case still written using test-unit but now converted we can safely remove the test-unit dependency.
1 parent f171d8f commit eac1064

2 files changed

Lines changed: 15 additions & 18 deletions

File tree

clockwork.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,4 @@ Gem::Specification.new do |s|
2424
s.add_development_dependency "daemons"
2525
s.add_development_dependency "minitest", "~> 5.8"
2626
s.add_development_dependency "mocha"
27-
s.add_development_dependency "test-unit"
2827
end

test/signal_test.rb

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
1-
require 'test/unit'
1+
require "minitest/autorun"
22
require 'mocha/minitest'
33
require 'fileutils'
44

5-
class SignalTest < Test::Unit::TestCase
6-
CMD = File.expand_path('../../bin/clockwork', __FILE__)
7-
SAMPLE = File.expand_path('../samples/signal_test.rb', __FILE__)
8-
LOGFILE = File.expand_path('../tmp/signal_test.log', __FILE__)
9-
10-
setup do
11-
FileUtils.mkdir_p(File.dirname(LOGFILE))
12-
@pid = spawn(CMD, SAMPLE)
13-
until File.exist?(LOGFILE)
5+
describe "SignalTest" do
6+
before do
7+
@command = File.expand_path('../../bin/clockwork', __FILE__)
8+
@sample = File.expand_path('../samples/signal_test.rb', __FILE__)
9+
@logfile = File.expand_path('../tmp/signal_test.log', __FILE__)
10+
FileUtils.mkdir_p(File.dirname(@logfile))
11+
@pid = spawn(@command, @sample)
12+
until File.exist?(@logfile)
1413
sleep 0.1
1514
end
1615
end
1716

18-
teardown do
19-
FileUtils.rm_r(File.dirname(LOGFILE))
17+
after do
18+
FileUtils.rm_r(File.dirname(@logfile))
2019
end
2120

22-
test 'should gracefully shutdown with SIGTERM' do
21+
it 'should gracefully shutdown with SIGTERM' do
2322
Process.kill(:TERM, @pid)
2423
sleep 0.2
25-
assert_equal 'done', File.read(LOGFILE)
24+
assert_equal 'done', File.read(@logfile)
2625
end
2726

28-
test 'should forcely shutdown with SIGINT' do
27+
it 'should forcely shutdown with SIGINT' do
2928
Process.kill(:INT, @pid)
3029
sleep 0.2
31-
assert_equal 'start', File.read(LOGFILE)
30+
assert_equal 'start', File.read(@logfile)
3231
end
3332
end
34-

0 commit comments

Comments
 (0)