Commit 5e746850fa7a300f18cae8d7936952e2ba071f4c

Authored by AntonioTerceiro
1 parent 87648bee

ActionItem135: accepting empty body for TextileArticle



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1162 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/textile_article.rb
... ... @@ -9,7 +9,7 @@ class TextileArticle < Article
9 9 end
10 10  
11 11 def to_html
12   - RedCloth.new(self.body).to_html
  12 + RedCloth.new(self.body|| '').to_html
13 13 end
14 14  
15 15 end
... ...
test/unit/textile_article_test.rb
... ... @@ -23,4 +23,12 @@ class TextileArticleTest < Test::Unit::TestCase
23 23 assert_equal '<p><strong>my text</strong></p>', TextileArticle.new(:body => '*my text*').to_html
24 24 end
25 25  
  26 + should 'accept empty body' do
  27 + a = TextileArticle.new
  28 + a.expects(:body).returns(nil)
  29 + assert_nothing_raised do
  30 + assert_equal '', a.to_html
  31 + end
  32 + end
  33 +
26 34 end
... ...