Skip to content
Browse files

check for Resque::Job instead of just Resque

  • Loading branch information...
1 parent ad7ffd5 commit 6e9aa9280766fd0c85b1eb24e369300637dfa5e1 Chad Pytel committed Jun 21, 2011
Showing with 12 additions and 3 deletions.
  1. +2 −2 .bundle/config
  2. +1 −1 lib/copycopter_client/process_guard.rb
  3. +9 −0 spec/copycopter_client/process_guard_spec.rb
View
4 .bundle/config
@@ -1,2 +1,2 @@
----
-BUNDLE_DISABLE_SHARED_GEMS: "1"
+--- {}
+
View
2 lib/copycopter_client/process_guard.rb
@@ -75,7 +75,7 @@ def register_exit_hooks
end
def register_job_hooks
- if defined?(Resque)
+ if defined?(Resque::Job)
@logger.info("Registered Resque after_perform hook")
cache = @cache
Resque::Job.class_eval do
View
9 spec/copycopter_client/process_guard_spec.rb
@@ -106,4 +106,13 @@ def build_process_guard(options = {})
cache.should be_written
logger.should have_entry(:info, "Registered Resque after_perform hook")
end
+
+ it "doesn't fail if only Resque is defined and not Resque::Job" do
+ logger = FakeLogger.new
+ cache = WritingCache.new
+ define_constant('Resque', Module.new)
+ process_guard = build_process_guard(:cache => cache, :logger => logger)
+
+ process_guard.start
+ end
end

0 comments on commit 6e9aa92

Please sign in to comment.
Something went wrong with that request. Please try again.