Skip to content

Commit

Permalink
Add interceptor test.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlazio committed Oct 27, 2014
1 parent d78e80f commit 3b6737f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/lib/disable_email_interceptor_spec.rb
@@ -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

0 comments on commit 3b6737f

Please sign in to comment.