summaryrefslogtreecommitdiff
path: root/spec/mailers
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-02-28 10:49:59 +0100
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 15:40:41 +0200
commitc1281982bd7975b45bed5b8e2c5ef5e242ea18fd (patch)
treea4a76d4cd9ab0d4ca324902355fa60ced1ecdb9b /spec/mailers
parentf0fe1b9d4397e6c1c6aa2da6e371e234db774fe2 (diff)
downloadgitlab-ce-c1281982bd7975b45bed5b8e2c5ef5e242ea18fd.tar.gz
notification email on add new gpg key
Diffstat (limited to 'spec/mailers')
-rw-r--r--spec/mailers/emails/profile_spec.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/mailers/emails/profile_spec.rb b/spec/mailers/emails/profile_spec.rb
index 8c1c9bf135f..09e5094cf84 100644
--- a/spec/mailers/emails/profile_spec.rb
+++ b/spec/mailers/emails/profile_spec.rb
@@ -91,6 +91,36 @@ describe Emails::Profile do
end
end
+ describe 'user added gpg key' do
+ let(:gpg_key) { create(:gpg_key) }
+
+ subject { Notify.new_gpg_key_email(gpg_key.id) }
+
+ it_behaves_like 'an email sent from GitLab'
+ it_behaves_like 'it should not have Gmail Actions links'
+ it_behaves_like 'a user cannot unsubscribe through footer link'
+
+ it 'is sent to the new user' do
+ is_expected.to deliver_to gpg_key.user.email
+ end
+
+ it 'has the correct subject' do
+ is_expected.to have_subject /^GPG key was added to your account$/i
+ end
+
+ it 'contains the new gpg key title' do
+ is_expected.to have_body_text /#{gpg_key.fingerprint}/
+ end
+
+ it 'includes a link to gpg keys page' do
+ is_expected.to have_body_text /#{profile_gpg_keys_path}/
+ end
+
+ context 'with GPG key that does not exist' do
+ it { expect { Notify.new_gpg_key_email('foo') }.not_to raise_error }
+ end
+ end
+
describe 'user added email' do
let(:email) { create(:email) }