debian-mirror-gitlab/spec/lib/gitlab/email/receiver_spec.rb

23 lines
636 B
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
require 'spec_helper'
require_relative 'email_shared_blocks'
2015-09-25 12:07:36 +05:30
2015-12-23 02:04:40 +05:30
describe Gitlab::Email::Receiver, lib: true do
2016-09-13 17:45:13 +05:30
include_context :email_shared_context
2015-09-25 12:07:36 +05:30
2016-09-13 17:45:13 +05:30
context "when we cannot find a capable handler" do
let(:email_raw) { fixture_file('emails/valid_reply.eml').gsub(mail_key, "!!!") }
2015-09-25 12:07:36 +05:30
2016-09-13 17:45:13 +05:30
it "raises a UnknownIncomingEmail" do
expect { receiver.execute }.to raise_error(Gitlab::Email::UnknownIncomingEmail)
2015-09-25 12:07:36 +05:30
end
end
context "when the email is blank" do
let(:email_raw) { "" }
it "raises an EmptyEmailError" do
2016-09-13 17:45:13 +05:30
expect { receiver.execute }.to raise_error(Gitlab::Email::EmptyEmailError)
2016-06-02 11:05:42 +05:30
end
2015-09-25 12:07:36 +05:30
end
end