2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2017-03-16 22:31:42 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
describe FormatHelper, type: :helper do
|
|
|
|
|
|
|
|
|
|
describe 'markdown' do
|
|
|
|
|
it 'should return empty string for nil' do
|
|
|
|
|
expect(markdown(nil)).to eq ''
|
|
|
|
|
end
|
|
|
|
|
|
2022-03-17 16:47:47 -07:00
|
|
|
it "doesn't render links with unsafe URI schemes" do
|
|
|
|
|
expect(markdown('[a](javascript:b)')).to eq "<p>[a](javascript:b)</p>\n"
|
2022-03-17 16:44:27 -07:00
|
|
|
end
|
|
|
|
|
|
2017-03-16 22:31:42 +05:30
|
|
|
it 'should return HTML for header markdown' do
|
|
|
|
|
expect(markdown('# this is my header')).to eq "<h1>this is my header</h1>\n"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|