2016-05-24 05:30:36 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
require_relative 'email_shared_blocks'
|
2015-08-20 15:17:59 -04:00
|
|
|
|
2015-12-09 05:55:36 -05:00
|
|
|
describe Gitlab::Email::Receiver, lib: true do
|
2016-05-24 05:30:36 -04:00
|
|
|
include_context :email_shared_context
|
2015-08-20 15:17:59 -04:00
|
|
|
|
2016-05-23 13:19:20 -04:00
|
|
|
context "when we cannot find a capable handler" do
|
|
|
|
let(:email_raw) { fixture_file('emails/valid_reply.eml').gsub(mail_key, "!!!") }
|
|
|
|
|
|
|
|
it "raises a UnknownIncomingEmail" do
|
|
|
|
expect { receiver.execute }.to raise_error(Gitlab::Email::UnknownIncomingEmail)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-08-20 15:17:59 -04:00
|
|
|
context "when the email is blank" do
|
|
|
|
let(:email_raw) { "" }
|
|
|
|
|
|
|
|
it "raises an EmptyEmailError" do
|
2016-05-18 18:19:25 -04:00
|
|
|
expect { receiver.execute }.to raise_error(Gitlab::Email::EmptyEmailError)
|
2015-08-20 15:17:59 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|