Skip to content

Commit

Permalink
portraits are imported
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jan 1, 2011
1 parent b9f84e8 commit 197cbcf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/account.rb
Expand Up @@ -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
9 changes: 9 additions & 0 deletions test/unit/account_test.rb
Expand Up @@ -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.