require'spec_helper'describeBuildsEmailServicedolet(:build){create(:ci_build)}let(:data){Gitlab::BuildDataBuilder.build(build)}let(:service){BuildsEmailService.new}describe:executedoit"sends email"doservice.recipients='test@gitlab.com'data[:build_status]='failed'expect(BuildEmailWorker).toreceive(:perform_async)service.execute(data)endit"does not sends email with failed build and allowed_failure on"dodata[:build_status]='failed'data[:build_allow_failure]=trueexpect(BuildEmailWorker).not_toreceive(:perform_async)service.execute(data)endendend