The test suite says that a duplicate job is not added, which is the desired behavior.
But what else happens? Is an error raised? Is false returned? How does one know if success occurred or not? The nearest I can tell is that perform just won't return a job_id:
TestJob.perform_async :arg => 1
# => "1234..."
TestJob.perform_async :arg => 1 # a duplicate!
# => nil
The test suite doesn't make it clear how to check this, since it works by looking at the queue size, which definitely isn't the correct strategy for production, since jobs are being added and removed all the time.
The test suite says that a duplicate job is not added, which is the desired behavior.
But what else happens? Is an error raised? Is
falsereturned? How does one know if success occurred or not? The nearest I can tell is thatperformjust won't return a job_id:The test suite doesn't make it clear how to check this, since it works by looking at the queue size, which definitely isn't the correct strategy for production, since jobs are being added and removed all the time.