Friday, May 16, 2014

Rails test with method that invoke delayed job

class Klass
def some_function
self.delay.time_consuming_function
end

def time_consuming_function
...
end
end

class KlassTest

test "some_function" do
Delayed::Job.all.each { |job| job.destroy }
Klass.new.some_function
Delayed::Job.all.each { |job| job.invoke_job }

assert ...
end

end

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.