Skip to content

Commit 46d2466

Browse files
committed
Merge pull request resque#639 from wuputah/fix-broken-tests
Fix broken tests
2 parents bff4786 + 9577139 commit 46d2466

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/test_helper.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'rubygems'
22

3-
dir = File.dirname(File.expand_path(__FILE__))
4-
$LOAD_PATH.unshift dir + '/../lib'
3+
$dir = File.dirname(File.expand_path(__FILE__))
4+
$LOAD_PATH.unshift $dir + '/../lib'
55
$TESTING = true
66
require 'test/unit'
77

@@ -42,21 +42,21 @@
4242
processes = `ps -A -o pid,command | grep [r]edis-test`.split("\n")
4343
pids = processes.map { |process| process.split(" ")[0] }
4444
puts "Killing test redis server..."
45-
`rm -f #{dir}/dump.rdb #{dir}/dump-cluster.rdb`
46-
pids.each { |pid| Process.kill("KILL", pid.to_i) }
45+
pids.each { |pid| Process.kill("TERM", pid.to_i) }
46+
system("rm -f #{$dir}/dump.rdb #{$dir}/dump-cluster.rdb")
4747
exit exit_code
4848
end
4949

5050
if ENV.key? 'RESQUE_DISTRIBUTED'
5151
require 'redis/distributed'
5252
puts "Starting redis for testing at localhost:9736 and localhost:9737..."
53-
`redis-server #{dir}/redis-test.conf`
54-
`redis-server #{dir}/redis-test-cluster.conf`
53+
`redis-server #{$dir}/redis-test.conf`
54+
`redis-server #{$dir}/redis-test-cluster.conf`
5555
r = Redis::Distributed.new(['redis://localhost:9736', 'redis://localhost:9737'])
5656
Resque.redis = Redis::Namespace.new :resque, :redis => r
5757
else
5858
puts "Starting redis for testing at localhost:9736..."
59-
`redis-server #{dir}/redis-test.conf`
59+
`redis-server #{$dir}/redis-test.conf`
6060
Resque.redis = 'localhost:9736'
6161
end
6262

test/worker_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def self.perform
286286
test "knows when it started" do
287287
time = Time.now
288288
@worker.work(0) do
289-
assert_equal time.to_s, @worker.started.to_s
289+
assert Time.parse(@worker.started) - time < 0.1
290290
end
291291
end
292292

0 commit comments

Comments
 (0)