forked from hotsh/rstat.us
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use HEAD instead of GET for gravatar image check. Add simple tests fo…
…r Author.
- Loading branch information
james cook
committed
Mar 25, 2011
1 parent
59bb47c
commit 91450c7
Showing
2 changed files
with
62 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require_relative "test_helper" | ||
|
||
class AuthorTest < MiniTest::Unit::TestCase | ||
|
||
include TestHelper | ||
def setup | ||
@author = Factory.build :author, :username => "james", :email => nil, :image_url => nil | ||
@author.instance_variable_set "@use_gravatar", true | ||
end | ||
|
||
def test_create_from_hash | ||
hash = {"user_info" => {"name" => "james", "nickname" => "jim", "urls" => {}} } | ||
assert Author.create_from_hash!(hash).is_a?(Author) | ||
end | ||
|
||
def test_url | ||
@author.remote_url = "some_url.com" | ||
assert_equal @author.url, @author.remote_url | ||
end | ||
|
||
def test_valid_avatar_url | ||
@author.email = "[email protected]" | ||
assert_equal @author.avatar_url, @author.gravatar_url | ||
end | ||
|
||
def test_invalid_avatar_url | ||
@author.email = "[email protected]" | ||
assert_equal @author.avatar_url, "/images/avatar.png" | ||
end | ||
end |