Permalink
Browse files

portraits are imported

  • Loading branch information...
tenderlove committed Jan 1, 2011
1 parent b9f84e8 commit 197cbcfa77b47b8cda21bdd2597ed27d5d047357
Showing with 13 additions and 0 deletions.
  1. +4 −0 app/models/account.rb
  2. +9 −0 test/unit/account_test.rb
View
@@ -31,6 +31,10 @@ def self.import io
:feed => site['feed']
)
end
+
+ (record['portraits'] || []).each do |portrait|
+ account.portraits.create!(:url => portrait)
+ end
end
end
end
@@ -81,4 +81,13 @@ def test_imports_sites
assert_equal 'ja', site.lang
assert_equal 'http://i.loveruby.net/d/index.rdf', site.feed
end
+
+ def test_imports_portraits
+ assert_difference('Portrait.count', 2) do
+ File.open(@yml, 'rb') { |f| Account.import f }
+ end
+
+ account = Account.find_by_username 'aamine'
+ assert_equal 'http://jp.rubyist.net/magazine/?c=plugin;plugin=attach_download;p=0017-Hotlinks;file_name=aoki1.jpg', account.portraits.first.url
+ end
end

0 comments on commit 197cbcf

Please sign in to comment.