From f3b2d6beb1cf1d6c415c3956b465efc9e4e171db Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Fri, 19 Jun 2009 13:39:56 -0300 Subject: [PATCH] ActionItem1101: published articles should return to_html as reference_article does --- app/models/published_article.rb | 3 +++ test/unit/published_article_test.rb | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) 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