summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/email/handler_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/email/handler_spec.rb')
-rw-r--r--spec/lib/gitlab/email/handler_spec.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/email/handler_spec.rb b/spec/lib/gitlab/email/handler_spec.rb
index 5014e4c22ce..6dbf069f07c 100644
--- a/spec/lib/gitlab/email/handler_spec.rb
+++ b/spec/lib/gitlab/email/handler_spec.rb
@@ -6,6 +6,18 @@ describe Gitlab::Email::Handler do
let(:email) { Mail.new { body 'email' } }
describe '.for' do
+ context 'key matches the reply_key of a notification' do
+ it 'picks note handler' do
+ expect(described_class.for(email, '1234567890abcdef1234567890abcdef')).to be_an_instance_of(Gitlab::Email::Handler::CreateNoteHandler)
+ end
+ end
+
+ context 'key matches the reply_key of a notification, along with an unsubscribe suffix' do
+ it 'picks unsubscribe handler' do
+ expect(described_class.for(email, '1234567890abcdef1234567890abcdef-unsubscribe')).to be_an_instance_of(Gitlab::Email::Handler::UnsubscribeHandler)
+ end
+ end
+
it 'picks issue handler if there is no merge request prefix' do
expect(described_class.for(email, 'project+key')).to be_an_instance_of(Gitlab::Email::Handler::CreateIssueHandler)
end