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
|
|
|
|
|
|
|
|
|
|
it 'should return HTML for header markdown' do
|
2017-03-24 04:12:25 +05:30
|
|
|
expect(Redcarpet::Markdown).to receive(:new)
|
2021-10-11 17:58:10 +02:00
|
|
|
.with(Redcarpet::Render::HTML, autolink: true, space_after_headers: true, no_intra_emphasis: true, fenced_code_blocks: true, disable_indented_code_blocks: true, safe_links_only: true)
|
2017-03-24 04:12:25 +05:30
|
|
|
.and_call_original
|
2017-03-16 22:31:42 +05:30
|
|
|
|
|
|
|
|
expect(markdown('# this is my header')).to eq "<h1>this is my header</h1>\n"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|