small bug in markdownify to prevent barfing with a nil message

This commit is contained in:
Maxwell Salzberg 2011-08-30 10:12:35 -07:00
parent e25decedc3
commit bb8a9f0b3f
2 changed files with 5 additions and 0 deletions

View file

@ -6,6 +6,7 @@ require File.expand_path("#{Rails.root}/lib/diaspora/markdownify")
module MarkdownifyHelper
def markdownify(message, render_options={})
return '' if message.blank?
markdown_options = {
:autolink => true,
:fenced_code_blocks => true,

View file

@ -290,6 +290,10 @@ describe MarkdownifyHelper do
end
end
it 'does not barf is message is nil' do
markdownify(nil).should == ''
end
context 'performance' do
before do
@message = "HHello,Hello_, I _am a strong robot.*Hello, I am *a strong robot.Hello, I am a strong robot.Hello, I am a strong robot.Hello, I am a strong robot.Hello, I am a **strong robot.Hello, I am _a _strong *robot**.Hello*, I am a strong "