summaryrefslogtreecommitdiff
path: root/spec/mailers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-11 15:08:10 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-02-12 14:01:27 +0100
commitc9f202b2efdecda2e9fa5290ba5de413ab345a7d (patch)
treebc9dd9fe972d1ea34aa19c3e08307daed18ad8f0 /spec/mailers
parentb1dda8145433f15fcea683451c9c79927b19352e (diff)
downloadgitlab-ce-c9f202b2efdecda2e9fa5290ba5de413ab345a7d.tar.gz
Fix broken link in CI build notification emails
Closes #13199
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/notify_spec.rb78
1 files changed, 40 insertions, 38 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index 82bd057b16c..c22ff7f8cea 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -13,7 +13,6 @@ describe Notify do
let(:gitlab_sender_reply_to) { Gitlab.config.gitlab.email_reply_to }
let(:recipient) { create(:user, email: 'recipient@example.com') }
let(:project) { create(:project) }
- let(:build) { create(:ci_build) }
before(:each) do
ActionMailer::Base.deliveries.clear
@@ -48,13 +47,6 @@ describe Notify do
end
end
- shared_examples 'an email with X-GitLab headers containing build details' do
- it 'has X-GitLab-Build* headers' do
- is_expected.to have_header 'X-GitLab-Build-Id', /#{build.id}/
- is_expected.to have_header 'X-GitLab-Build-Ref', /#{build.ref}/
- end
- end
-
shared_examples 'an email that contains a header with author username' do
it 'has X-GitLab-Author header containing author\'s username' do
is_expected.to have_header 'X-GitLab-Author', user.username
@@ -971,49 +963,59 @@ describe Notify do
end
end
- describe 'build success' do
- before { build.success }
+ describe 'build notification email' do
+ let(:build) { create(:ci_build) }
+ let(:project) { build.project }
- subject { Notify.build_success_email(build.id, 'wow@example.com') }
-
- it_behaves_like 'an email with X-GitLab headers containing build details'
- it_behaves_like 'an email with X-GitLab headers containing project details' do
- let(:project) { build.project }
- end
+ shared_examples 'build email' do
+ it 'contains name of project' do
+ is_expected.to have_body_text build.project_name
+ end
- it 'has header indicating build status' do
- is_expected.to have_header 'X-GitLab-Build-Status', 'success'
+ it 'contains link to project' do
+ is_expected.to have_body_text namespace_project_path(project.namespace, project)
+ end
end
- it 'has the correct subject' do
- should have_subject /Build success for/
+ shared_examples 'an email with X-GitLab headers containing build details' do
+ it 'has X-GitLab-Build* headers' do
+ is_expected.to have_header 'X-GitLab-Build-Id', /#{build.id}/
+ is_expected.to have_header 'X-GitLab-Build-Ref', /#{build.ref}/
+ end
end
- it 'contains name of project' do
- should have_body_text build.project_name
- end
- end
+ describe 'build success' do
+ subject { Notify.build_success_email(build.id, 'wow@example.com') }
+ before { build.success }
- describe 'build fail' do
- before { build.drop }
+ it_behaves_like 'build email'
+ it_behaves_like 'an email with X-GitLab headers containing build details'
+ it_behaves_like 'an email with X-GitLab headers containing project details'
- subject { Notify.build_fail_email(build.id, 'wow@example.com') }
+ it 'has header indicating build status' do
+ is_expected.to have_header 'X-GitLab-Build-Status', 'success'
+ end
- it_behaves_like 'an email with X-GitLab headers containing build details'
- it_behaves_like 'an email with X-GitLab headers containing project details' do
- let(:project) { build.project }
+ it 'has the correct subject' do
+ is_expected.to have_subject /Build success for/
+ end
end
- it 'has header indicating build status' do
- is_expected.to have_header 'X-GitLab-Build-Status', 'failed'
- end
+ describe 'build fail' do
+ subject { Notify.build_fail_email(build.id, 'wow@example.com') }
+ before { build.drop }
- it 'has the correct subject' do
- should have_subject /Build failed for/
- end
+ it_behaves_like 'build email'
+ it_behaves_like 'an email with X-GitLab headers containing build details'
+ it_behaves_like 'an email with X-GitLab headers containing project details'
- it 'contains name of project' do
- should have_body_text build.project_name
+ it 'has header indicating build status' do
+ is_expected.to have_header 'X-GitLab-Build-Status', 'failed'
+ end
+
+ it 'has the correct subject' do
+ is_expected.to have_subject /Build failed for/
+ end
end
end
end