Skip to content
Browse files

making sure the return values get passed to Navvy::Job#completed

  • Loading branch information...
1 parent 6bde639 commit a4fd2bbe9a54d8e9df288e090253bcf929eba2c1 @jeffkreeftmeijer committed Jul 11, 2010
Showing with 9 additions and 2 deletions.
  1. +2 −2 lib/navvy/job.rb
  2. +7 −0 spec/job_spec.rb
View
4 lib/navvy/job.rb
@@ -65,7 +65,7 @@ def run
begin
started
result = constantize(object).send(method_name, *args)
- Navvy::Job.keep? ? completed : destroy
+ Navvy::Job.keep? ? completed(result) : destroy
result
rescue Exception => exception
failed(exception.message)
@@ -170,4 +170,4 @@ def constantize(str)
constant
end
end
-end
+end
View
7 spec/job_spec.rb
@@ -207,6 +207,13 @@
end
describe 'when Navvy::Job.keep is set' do
+ it 'should call #completed with the return value after processing the job' do
+ Navvy::Job.keep = true
+ jobs = Navvy::Job.next
+ jobs.first.should_receive(:completed).with('moo')
+ jobs.first.run
+ end
+
it 'should mark the job as complete when keep is true' do
Navvy::Job.keep = true
jobs = Navvy::Job.next

0 comments on commit a4fd2bb

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