summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-08-10 13:13:52 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2017-08-11 16:02:11 -0700
commit02b5d359b5ad9deeb0ac2d04487eb43a3089bc99 (patch)
tree4de6e68913765c0aaebb06b898e52a538e81045d
parent8f6205d1442cb6d88e992bff7a07c088ae92d93a (diff)
downloadgitlab-ce-02b5d359b5ad9deeb0ac2d04487eb43a3089bc99.tar.gz
restructure the #new_key notification spec
-rw-r--r--spec/services/notification_service_spec.rb17
1 files changed, 6 insertions, 11 deletions
diff --git a/spec/services/notification_service_spec.rb b/spec/services/notification_service_spec.rb
index d7ac0746df4..44d3f441382 100644
--- a/spec/services/notification_service_spec.rb
+++ b/spec/services/notification_service_spec.rb
@@ -80,21 +80,16 @@ describe NotificationService, :mailer do
describe 'Keys' do
describe '#new_key' do
- let!(:key) { create(:personal_key) }
+ let(:key_options) { {} }
+ let!(:key) { create(:personal_key, key_options) }
it { expect(notification.new_key(key)).to be_truthy }
+ it { should_email(key.user) }
- it 'sends email to key owner' do
- expect { notification.new_key(key) }.to change { ActionMailer::Base.deliveries.size }.by(1)
- end
-
- it 'never emails the ghost user' do
- key.user = User.ghost
-
- reset_delivered_emails!
- notification.new_key(key)
+ describe 'never emails the ghost user' do
+ let(:key_options) { { user: User.ghost } }
- should_not_email_anyone
+ it { should_not_email_anyone }
end
end
end