Welcome to mirror list, hosted at ThFree Co, Russian Federation.

disable_email_interceptor_spec.rb « hook « email « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 47f6015c6f883f93e2e7a437a8825e739d645563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::Email::Hook::DisableEmailInterceptor do
  before do
    Mail.register_interceptor(described_class)
  end

  it 'does not send emails' do
    allow(Gitlab.config.gitlab).to receive(:email_enabled).and_return(false)
    expect { deliver_mail }.not_to change(ActionMailer::Base.deliveries, :count)
  end

  after do
    Mail.unregister_interceptor(described_class)
  end

  def deliver_mail
    key = create :personal_key
    Notify.new_ssh_key_email(key.id)
  end
end