diff --git a/lib/resque/worker_registry.rb b/lib/resque/worker_registry.rb index 948eb3a6d..d41b2ee0b 100644 --- a/lib/resque/worker_registry.rb +++ b/lib/resque/worker_registry.rb @@ -3,7 +3,7 @@ module Resque class WorkerRegistry REDIS_WORKERS_KEY = :workers REDIS_SINGLE_WORKER_KEY = :worker - + # Direct access to the Redis instance. def redis Resque.redis diff --git a/test/resque/worker_test.rb b/test/resque/worker_test.rb index 94038eec7..d6f7a7bc2 100644 --- a/test/resque/worker_test.rb +++ b/test/resque/worker_test.rb @@ -1,6 +1,7 @@ require 'test_helper' require 'resque/worker' +require 'socket' describe Resque::Worker do describe "#state" do @@ -13,4 +14,16 @@ end end end + + describe "#to_s, #inspect" do + it "gives us string representations of a worker" do + worker = Resque::Worker.new(:queue => "foo") + Socket.stub(:gethostname, "test.com") do + worker.stub(:pid, "1234") do + assert_equal "test.com:1234:{:queue=>\"foo\"}", worker.to_s + assert_equal "#\"foo\"}>", worker.inspect + end + end + end + end end