chore: Support plus forwarding in email channel (#6482)
- Support for plus forwarding in the email addresses for email channels Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
@@ -24,6 +24,13 @@ describe ::EmailChannelFinder do
|
||||
channel = described_class.new(reply_mail.mail).perform
|
||||
expect(channel).to eq(channel_email)
|
||||
end
|
||||
|
||||
it 'return channel with to+extension email' do
|
||||
channel_email.update(email: 'test@example.com')
|
||||
reply_mail.mail['to'] = 'test+123@example.com'
|
||||
channel = described_class.new(reply_mail.mail).perform
|
||||
expect(channel).to eq(channel_email)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
19
spec/helpers/email_helper_spec.rb
Normal file
19
spec/helpers/email_helper_spec.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe EmailHelper, type: :helper do
|
||||
describe '#normalize_email_with_plus_addressing' do
|
||||
context 'when email is passed' do
|
||||
it 'normalise if plus addressing is present' do
|
||||
expect(helper.normalize_email_with_plus_addressing('john+test@acme.inc')).to eq 'john@acme.inc'
|
||||
end
|
||||
|
||||
it 'returns original if plus addressing is not present' do
|
||||
expect(helper.normalize_email_with_plus_addressing('john@acme.inc')).to eq 'john@acme.inc'
|
||||
end
|
||||
|
||||
it 'returns downcased version of email' do
|
||||
expect(helper.normalize_email_with_plus_addressing('JoHn+AAsdfss@acme.inc')).to eq 'john@acme.inc'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user