diff options
author | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-28 13:36:28 +0000 |
---|---|---|
committer | Dmitriy Zaporozhets <dzaporozhets@gitlab.com> | 2014-10-28 13:36:28 +0000 |
commit | eaebc20eba284a84fef17b2159f7eb6f87f2ff82 (patch) | |
tree | fd28b0c3e13b110c13c2e1dccf0ba2950298fe7a /spec | |
parent | 2a16bbd626fb95637e7da4103dc4e25f56ea3e1d (diff) | |
parent | 28c08775b3d1994d3a8c5057534c704ff9da4bae (diff) | |
download | gitlab-ce-eaebc20eba284a84fef17b2159f7eb6f87f2ff82.tar.gz |
Merge branch 'disable_email_option' into 'master'
Disable email option
Fixes #1569
See merge request !1222
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/disable_email_interceptor_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/disable_email_interceptor_spec.rb b/spec/lib/disable_email_interceptor_spec.rb new file mode 100644 index 00000000000..8bf6ee2ed50 --- /dev/null +++ b/spec/lib/disable_email_interceptor_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe DisableEmailInterceptor do + before do + ActionMailer::Base.register_interceptor(DisableEmailInterceptor) + end + + it 'should not send emails' do + Gitlab.config.gitlab.stub(:email_enabled).and_return(false) + expect { + deliver_mail + }.not_to change(ActionMailer::Base.deliveries, :count) + end + + after do + # Removing interceptor from the list because unregister_interceptor is + # implemented in later version of mail gem + # See: https://github.com/mikel/mail/pull/705 + Mail.class_variable_set(:@@delivery_interceptors, []) + end + + def deliver_mail + key = create :personal_key + Notify.new_ssh_key_email(key.id) + end +end |