Commit f3b2d6beb1cf1d6c415c3956b465efc9e4e171db

Authored by Daniela Feitosa
Committed by Joenio Costa
1 parent 88ac72d6

ActionItem1101: published articles should return to_html as reference_article does

app/models/published_article.rb
... ... @@ -31,4 +31,7 @@ class PublishedArticle < Article
31 31 end
32 32 end
33 33  
  34 + def to_html(options={})
  35 + reference_article.to_html
  36 + end
34 37 end
... ...
test/unit/published_article_test.rb
... ... @@ -92,4 +92,19 @@ class PublishedArticleTest < ActiveSupport::TestCase
92 92 assert p
93 93 assert_equal folder, p.parent
94 94 end
  95 +
  96 + should 'use to_html from reference_article' do
  97 + prof = Community.create!(:name => 'test_comm', :identifier => 'test_comm')
  98 + p = PublishedArticle.create!(:reference_article => @article, :profile => prof)
  99 +
  100 + assert_equal @article.to_html, p.to_html
  101 + end
  102 +
  103 + should 'use to_html from reference_article when is Textile' do
  104 + prof = Community.create!(:name => 'test_comm', :identifier => 'test_comm')
  105 + textile_article = TextileArticle.new(:name => 'textile_article', :body => '*my text*', :profile => prof)
  106 + p = PublishedArticle.create!(:reference_article => textile_article, :profile => prof)
  107 +
  108 + assert_equal textile_article.to_html, p.to_html
  109 + end
95 110 end
... ...