FIX: Autolinking in email formatter was broken
This commit is contained in:
parent
c2b769bd95
commit
0c3b049176
|
@ -3,7 +3,7 @@
|
|||
class EmailCook
|
||||
|
||||
def self.url_regexp
|
||||
/[^\>]*((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»\s]))/
|
||||
/^((?:https?:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.])(?:[^\s()<>]+|\([^\s()<>]+\))+(?:\([^\s()<>]+\)|[^`!()\[\]{};:'".,<>?«»“”‘’\s]))/
|
||||
end
|
||||
|
||||
def initialize(raw)
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
require 'rails_helper'
|
||||
require 'email_cook'
|
||||
|
||||
describe EmailCook do
|
||||
|
||||
it 'adds linebreaks' do
|
||||
expect(EmailCook.new("hello\nworld\n").cook).to eq("hello\n<br>world\n<br>")
|
||||
end
|
||||
|
||||
it 'autolinks' do
|
||||
expect(EmailCook.new("https://www.eviltrout.com").cook).to eq("<a href='https://www.eviltrout.com'>https://www.eviltrout.com</a><br>")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue