Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revert "removes nil-guard from PerformableMethod#perform"

This reverts commit 547e8a4.
  • Loading branch information...
commit ebded9478064de90f5e265994cd444f3869c5e98 1 parent 547e8a4
@dcuddeback authored
View
2  lib/delayed/performable_method.rb
@@ -23,7 +23,7 @@ def display_name
end
def perform
- object.send(method_name, *args)
+ object.send(method_name, *args) if object
end
def method_missing(symbol, *args)
View
14 spec/performable_method_spec.rb
@@ -11,8 +11,8 @@
@method.object = nil
end
- it "should raise an error if object is nil" do
- lambda { @method.perform }.should raise_error
+ it "should be a no-op if object is nil" do
+ lambda { @method.perform }.should_not raise_error
end
end
@@ -47,7 +47,7 @@ def private_method
story.delay.tell.invoke_job
end
end
-
+
%w(before after success).each do |hook|
it "should delegate #{hook} hook to object when delay_jobs = false" do
Delayed::Worker.delay_jobs = false
@@ -56,14 +56,14 @@ def private_method
story.delay.tell
end
end
-
+
it "should delegate error hook to object" do
story = Story.create
story.should_receive(:error).with(an_instance_of(Delayed::Job), an_instance_of(RuntimeError))
story.should_receive(:tell).and_raise(RuntimeError)
lambda { story.delay.tell.invoke_job }.should raise_error
end
-
+
it "should delegate error hook to object when delay_jobs = false" do
Delayed::Worker.delay_jobs = false
story = Story.create
@@ -77,13 +77,13 @@ def private_method
method.object.should_receive(:failure)
method.failure
end
-
+
it "should delegate failure hook to object when delay_jobs = false" do
Delayed::Worker.delay_jobs = false
method = Delayed::PerformableMethod.new("object", :size, [])
method.object.should_receive(:failure)
method.failure
end
-
+
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.