Skip to content

Instantly share code, notes, and snippets.

@hone
Created October 10, 2009 19:17
Show Gist options
  • Save hone/207066 to your computer and use it in GitHub Desktop.
Save hone/207066 to your computer and use it in GitHub Desktop.
module DelayedJobHelper
def stub_send_later(klass)
old_method = klass.method(:send_later)
klass.module_eval do
def self.send_later(method, *args)
self.send(method, *args)
end
end
old_method
end
def unstub_send_later(klass, old_method)
klass.module_eval <<EVAL
def self.send_later(method, *args)
#{old_method}.call(method, args)
end
EVAL
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment