require'spec_helper'describeGitlab::JobWaiterdodescribe'#wait'dolet(:waiter){described_class.new(%w(a))}it'returns when all jobs have been completed'doexpect(Gitlab::SidekiqStatus).toreceive(:all_completed?).with(%w(a)).and_return(true)expect(waiter).not_toreceive(:sleep)waiter.waitendit'sleeps between checking the job statuses'doexpect(Gitlab::SidekiqStatus).toreceive(:all_completed?).with(%w(a)).and_return(false,true)expect(waiter).toreceive(:sleep).with(described_class::INTERVAL)waiter.waitendit'returns when timing out'doexpect(waiter).not_toreceive(:sleep)waiter.wait(0)endendend