diff --git a/app/models/published_article.rb b/app/models/published_article.rb index d58ec32..7b3ffbd 100644 --- a/app/models/published_article.rb +++ b/app/models/published_article.rb @@ -31,4 +31,7 @@ class PublishedArticle < Article end end + def to_html(options={}) + reference_article.to_html + end end diff --git a/test/unit/published_article_test.rb b/test/unit/published_article_test.rb index edbcb0f..f2e3852 100644 --- a/test/unit/published_article_test.rb +++ b/test/unit/published_article_test.rb @@ -92,4 +92,19 @@ class PublishedArticleTest < ActiveSupport::TestCase assert p assert_equal folder, p.parent end + + should 'use to_html from reference_article' do + prof = Community.create!(:name => 'test_comm', :identifier => 'test_comm') + p = PublishedArticle.create!(:reference_article => @article, :profile => prof) + + assert_equal @article.to_html, p.to_html + end + + should 'use to_html from reference_article when is Textile' do + prof = Community.create!(:name => 'test_comm', :identifier => 'test_comm') + textile_article = TextileArticle.new(:name => 'textile_article', :body => '*my text*', :profile => prof) + p = PublishedArticle.create!(:reference_article => textile_article, :profile => prof) + + assert_equal textile_article.to_html, p.to_html + end end -- libgit2 0.21.2