Mock dispatch instead of relying on rollback in child proc.
[arvados.git] / services / api / test / unit / crunch_dispatch_test.rb
index f01e50de91288a64bf5b756c9138765d1b2b7caf..09f4af6373fa03a2f4bdb79e332ea7b38130ff0a 100644 (file)
@@ -82,14 +82,9 @@ class CrunchDispatchTest < ActiveSupport::TestCase
           end
           ActiveRecord::Base.establish_connection
 
-          # Make sure the queue is empty. We don't really want to
-          # dispatch any jobs.
-          act_as_user users(:admin) do
-            Job.destroy_all
-            PipelineInstance.destroy_all
-          end
-
-          CrunchDispatch.new.run []
+          dispatch = CrunchDispatch.new
+          dispatch.stubs(:did_recently).returns true
+          dispatch.run []
         ensure
           Process.exit!
         end