diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-09-06 19:20:42 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-09-06 19:20:42 +0000 |
commit | 177d847cf5c0ad9f282f599fbd5e9dafdc3b6289 (patch) | |
tree | cf94abe3e3ae6b79582d9aa87e1d595b3f0dbda2 /spec/mailers | |
parent | a286e20d014e4092be7f03a2e1679f8f8434afa2 (diff) | |
download | gitlab-ce-177d847cf5c0ad9f282f599fbd5e9dafdc3b6289.tar.gz |
Automatically disable Auto DevOps for project upon first pipeline failure
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/auto_devops_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/mailers/emails/auto_devops_spec.rb b/spec/mailers/emails/auto_devops_spec.rb new file mode 100644 index 00000000000..839caf3f50e --- /dev/null +++ b/spec/mailers/emails/auto_devops_spec.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Emails::AutoDevops do + include EmailSpec::Matchers + + describe '#auto_devops_disabled_email' do + let(:owner) { create(:user) } + let(:namespace) { create(:namespace, owner: owner) } + let(:project) { create(:project, :repository, :auto_devops) } + let(:pipeline) { create(:ci_pipeline, :failed, project: project) } + + subject { Notify.autodevops_disabled_email(pipeline, owner.email) } + + it 'sents email with correct subject' do + is_expected.to have_subject("#{project.name} | Auto DevOps pipeline was disabled for #{project.name}") + end + + it 'sents an email to the user' do + recipient = subject.header[:to].addrs.map(&:address).first + + expect(recipient).to eq(owner.email) + end + + it 'is sent as GitLab email' do + sender = subject.header[:from].addrs[0].address + + expect(sender).to match(/gitlab/) + end + end +end |