Created
May 17, 2012 22:21
-
-
Save mikewadhera/2721967 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExceptionWithParams < Exception | |
attr_accessor :params | |
def initialize(params) | |
@params = params | |
end | |
end | |
class TestExceptionTask < Queueable::Tasks | |
def task_that_raises(arg) | |
raise "Bad things." | |
end | |
def on_processing_exception(exception, request_params) | |
raise ExceptionWithParams(request_params) | |
end | |
end | |
describe "exception handling" do | |
it "should pass request params when an exception is raised" do | |
lambda { | |
TestBackgroundTasks.send(:process, { :class => "TestExceptionTask", :action => "task_that_raises", :args => [123] }) | |
}.should_raise(ExceptionWithParams) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment