diff --git a/app/models/rss_feed.rb b/app/models/rss_feed.rb index 2d1168d..2798c6e 100644 --- a/app/models/rss_feed.rb +++ b/app/models/rss_feed.rb @@ -75,7 +75,6 @@ class RssFeed < Article end def data articles = fetch_articles - result = "" xml = Builder::XmlMarkup.new(:target => result) @@ -91,7 +90,7 @@ class RssFeed < Article xml.item do xml.title(article.name) if self.feed_item_description == 'body' - xml.description(article.body) + xml.description(article.to_html) else xml.description(article.abstract) end diff --git a/test/factories.rb b/test/factories.rb index fdfd7b6..fd2a70e 100644 --- a/test/factories.rb +++ b/test/factories.rb @@ -248,6 +248,10 @@ module Noosfero::Factory ############################################### # Blog ############################################### + def defaults_for_blog + { :name => 'My blog ' + factory_num_seq.to_s } + end + def create_blog profile = Profile.create!(:identifier => 'testuser' + factory_num_seq.to_s, :name => 'Test user') Blog.create!(:name => 'blog', :profile => profile) diff --git a/test/unit/rss_feed_test.rb b/test/unit/rss_feed_test.rb index b49916f..8d6f5cd 100644 --- a/test/unit/rss_feed_test.rb +++ b/test/unit/rss_feed_test.rb @@ -240,4 +240,15 @@ class RssFeedTest < Test::Unit::TestCase assert_equal false, a.can_display_hits? end + should 'display the referenced body of a PublishedArticle' do + article = fast_create(Article, :body => 'This is the content of the Sample Article.') + profile = fast_create(Profile) + blog = fast_create(Blog, :profile_id => profile.id) + published_article = PublishedArticle.create!(:reference_article => article, :profile => profile) + blog.posts << published_article + feed = RssFeed.new(:parent => blog, :profile => profile, :feed_item_description => 'body') + + assert_match published_article.to_html, feed.data + end + end -- libgit2 0.21.2