diff options
author | Brett Walker <bwalker@gitlab.com> | 2018-12-11 21:01:02 +0300 |
---|---|---|
committer | Brett Walker <bwalker@gitlab.com> | 2019-01-03 23:37:35 +0300 |
commit | 23d5f4c99138a74cb4176bfca3fe3fdad1beecc4 (patch) | |
tree | 3f450834de26cbc843f718a285312ee09b90c1c1 /spec/lib/gitlab/email | |
parent | 3a60173738c277b7ad7da31ebb577d1aaf694485 (diff) |
Use new unsubscribe link
We now use `-unsubscribe` instead of `+unsubscribe`
in order to support catch all email addresses
Diffstat (limited to 'spec/lib/gitlab/email')
-rw-r--r-- | spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb b/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb index b8660b133ec..040c0f294a5 100644 --- a/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb +++ b/spec/lib/gitlab/email/handler/unsubscribe_handler_spec.rb @@ -10,7 +10,7 @@ describe Gitlab::Email::Handler::UnsubscribeHandler do stub_config_setting(host: 'localhost') end - let(:email_raw) { fixture_file('emails/valid_reply.eml').gsub(mail_key, "#{mail_key}+unsubscribe") } + let(:email_raw) { fixture_file('emails/valid_reply.eml').gsub(mail_key, "#{mail_key}#{Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX}") } let(:project) { create(:project, :public) } let(:user) { create(:user) } let(:noteable) { create(:issue, project: project) } @@ -40,6 +40,14 @@ describe Gitlab::Email::Handler::UnsubscribeHandler do it 'unsubscribes user from notable' do expect { receiver.execute }.to change { noteable.subscribed?(user) }.from(true).to(false) end + + context 'when using old style unsubscribe link' do + let(:email_raw) { fixture_file('emails/valid_reply.eml').gsub(mail_key, "#{mail_key}#{Gitlab::IncomingEmail::UNSUBSCRIBE_SUFFIX_OLD}") } + + it 'unsubscribes user from notable' do + expect { receiver.execute }.to change { noteable.subscribed?(user) }.from(true).to(false) + end + end end context 'when the noteable could not be found' do |