Add interceptor test.
This commit is contained in:
parent
d78e80fa74
commit
3b6737f970
1 changed files with 23 additions and 0 deletions
23
spec/lib/disable_email_interceptor_spec.rb
Normal file
23
spec/lib/disable_email_interceptor_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
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
|
||||
Mail.class_variable_set(:@@delivery_interceptors, [])
|
||||
end
|
||||
|
||||
def deliver_mail
|
||||
key = create :personal_key
|
||||
Notify.new_ssh_key_email(key.id)
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue