diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 18:08:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-17 18:08:05 +0000 |
commit | 184c2ced0761bd8dd7032619d16d3983fed7944a (patch) | |
tree | cc82b32ee7c1797509da3cf384617e4ffa2e1733 /spec/mailers | |
parent | 238d22c07218adf2b8f3db630ee8b74ca6f29df5 (diff) | |
download | gitlab-ce-184c2ced0761bd8dd7032619d16d3983fed7944a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers')
-rw-r--r-- | spec/mailers/emails/releases_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/mailers/emails/releases_spec.rb b/spec/mailers/emails/releases_spec.rb new file mode 100644 index 00000000000..19f404db2a6 --- /dev/null +++ b/spec/mailers/emails/releases_spec.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +require 'spec_helper' +require 'email_spec' + +describe Emails::Releases do + include EmailSpec::Matchers + include_context 'gitlab email notification' + + describe '#new_release_email' do + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project) } + let(:release) { create(:release, project: project) } + + subject { Notify.new_release_email(user.id, release) } + + it_behaves_like 'an email sent from GitLab' + + context 'when the release has a name' do + it 'shows the correct subject' do + expected_subject = "#{release.project.name} | New release: #{release.name} - #{release.tag}" + is_expected.to have_subject(expected_subject) + end + end + + context 'when the release does not have a name' do + it 'shows the correct subject' do + release.name = nil + expected_subject = "#{release.project.name} | New release: #{release.tag}" + + is_expected.to have_subject(expected_subject) + end + end + + it 'contains a message with the new release tag' do + message = "A new Release #{release.tag} for #{release.project.name} was published." + is_expected.to have_body_text(message) + end + + it 'contains the release assets' do + is_expected.to have_body_text('Assets:') + release.sources do |source| + is_expected.to have_body_text("Download #{source.format}") + end + end + + it 'contains the release notes' do + is_expected.to have_body_text('Release notes:') + is_expected.to have_body_text(release.description) + end + end +end |