require'spec_helper'describeBuildFinishedWorkerdodescribe'#perform'docontext'when build exists'dolet(:build){create(:ci_build)}it'calculates coverage and calls hooks'doexpect(BuildCoverageWorker).toreceive(:new).ordered.and_call_originalexpect(BuildHooksWorker).toreceive(:new).ordered.and_call_originalexpect_any_instance_of(BuildCoverageWorker).toreceive(:perform)expect_any_instance_of(BuildHooksWorker).toreceive(:perform)described_class.new.perform(build.id)endendcontext'when build does not exist'doit'does not raise exception'doexpect{described_class.new.perform(123)}.not_toraise_errorendendendend