diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-03 15:10:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-03 15:10:26 +0300 |
commit | 94822e35f8bfbca6f7b161e22f61b086efb51b2a (patch) | |
tree | 54cd209bc30fe9e7ff84c18a7ecbb1f5c7d0b52d /spec/mailers | |
parent | f3189d2a01f0b44915b5d7a2301af1445f759c9f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/pipelines_spec.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/mailers/emails/pipelines_spec.rb b/spec/mailers/emails/pipelines_spec.rb index b9bc53625ac..3a2eb105964 100644 --- a/spec/mailers/emails/pipelines_spec.rb +++ b/spec/mailers/emails/pipelines_spec.rb @@ -71,10 +71,19 @@ RSpec.describe Emails::Pipelines do end end + shared_examples_for 'only accepts a single recipient' do + let(:recipient) { ['test@gitlab.com', 'test2@gitlab.com'] } + + it 'raises an ArgumentError' do + expect { subject.deliver_now }.to raise_error(ArgumentError) + end + end + describe '#pipeline_success_email' do - subject { Notify.pipeline_success_email(pipeline, pipeline.user.try(:email)) } + subject { Notify.pipeline_success_email(pipeline, recipient) } let(:pipeline) { create(:ci_pipeline, project: project, ref: ref, sha: sha) } + let(:recipient) { pipeline.user.try(:email) } let(:ref) { 'master' } let(:sha) { project.commit(ref).sha } @@ -93,12 +102,15 @@ RSpec.describe Emails::Pipelines do stub_config_setting(email_subject_suffix: email_subject_suffix) end end + + it_behaves_like 'only accepts a single recipient' end describe '#pipeline_failed_email' do - subject { Notify.pipeline_failed_email(pipeline, pipeline.user.try(:email)) } + subject { Notify.pipeline_failed_email(pipeline, recipient) } let(:pipeline) { create(:ci_pipeline, project: project, ref: ref, sha: sha) } + let(:recipient) { pipeline.user.try(:email) } let(:ref) { 'master' } let(:sha) { project.commit(ref).sha } @@ -106,12 +118,15 @@ RSpec.describe Emails::Pipelines do let(:status) { 'Failed' } let(:status_text) { "Pipeline ##{pipeline.id} has failed!" } end + + it_behaves_like 'only accepts a single recipient' end describe '#pipeline_fixed_email' do subject { Notify.pipeline_fixed_email(pipeline, pipeline.user.try(:email)) } let(:pipeline) { create(:ci_pipeline, project: project, ref: ref, sha: sha) } + let(:recipient) { pipeline.user.try(:email) } let(:ref) { 'master' } let(:sha) { project.commit(ref).sha } @@ -119,5 +134,7 @@ RSpec.describe Emails::Pipelines do let(:status) { 'Fixed' } let(:status_text) { "Pipeline has been fixed and ##{pipeline.id} has passed!" } end + + it_behaves_like 'only accepts a single recipient' end end |