From 1a2951afacb28652030f2c97b93c20b785f4b7bf Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 11 Sep 2014 12:11:05 -0300 Subject: [PATCH] ExternalFeed: use feed title as author name --- app/models/external_feed.rb | 1 + test/unit/external_feed_test.rb | 9 +++++++++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/app/models/external_feed.rb b/app/models/external_feed.rb index 5497e51..2b8c524 100644 --- a/app/models/external_feed.rb +++ b/app/models/external_feed.rb @@ -30,6 +30,7 @@ class ExternalFeed < ActiveRecord::Base article.source = link article.profile = blog.profile article.parent = blog + article.author_name = self.feed_title unless blog.children.exists?(:slug => article.slug) article.save! article.delay.create_activity diff --git a/test/unit/external_feed_test.rb b/test/unit/external_feed_test.rb index ca4ff49..09337b8 100644 --- a/test/unit/external_feed_test.rb +++ b/test/unit/external_feed_test.rb @@ -167,4 +167,13 @@ class ExternalFeedTest < ActiveSupport::TestCase assert_equal '

Html content 1.

Html content 2.

', dd.sort.join end + should 'use feed title as author name' do + blog = create_blog + e = build(:external_feed, :blog => blog, :feed_title => 'The Source') + e.add_item('Article title', 'http://orig.link.invalid', Time.now, '

Html content 1.

') + + assert_equal "The Source", blog.posts.first.author_name + + end + end -- libgit2 0.21.2