test/unit/test_job.rb in cloud-crowd-0.1.0 vs test/unit/test_job.rb in cloud-crowd-0.2.0
- old
+ new
@@ -24,10 +24,11 @@
end
should "know its completion status" do
assert !@job.all_work_units_complete?
@unit.update_attributes(:status => CloudCrowd::SUCCEEDED, :output => '{"output":"hello"}')
+ @job.check_for_completion
assert @job.reload.all_work_units_complete?
assert @job.percent_complete == 100
assert @job.outputs == "[\"hello\"]"
end
@@ -58,9 +59,11 @@
assert job.splittable?
assert job.splitting?
end
should "fire a callback when a job has finished, successfully or not" do
+ @job.update_attribute(:callback_url, 'http://example.com/callback')
+ CloudCrowd::Job.any_instance.stubs(:fire_callback).returns(true)
CloudCrowd::Job.any_instance.expects(:fire_callback)
@job.work_units.first.finish('{"output":"output"}', 10)
assert @job.all_work_units_complete?
end