This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented simple pavatar provider for tests
- test/lib/pavatar_provider.rb - simple sinatra pavatar provider - Samall updated to gemspec (rake gem:gem works now!)
- Loading branch information
Showing
5 changed files
with
28 additions
and
4 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
require 'rubygems' | ||
gem 'rack', '0.9.1' | ||
require 'sinatra' | ||
|
||
get '/' do | ||
response['X-Pavatar'] = 'http://blog.example.com/pavatar.png' | ||
response['X-Pavatar'] = 'http://localhost:4567/pavatar.png' | ||
end | ||
|
||
get '/pavatar.png' do | ||
attachement('pavatar.png') | ||
'yep' # we just need 200 | ||
end | ||
|
||
get '/hsegment/pavatar.png' do | ||
'yep' # we just need 200 | ||
end |
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,20 @@ | ||
require File.dirname(__FILE__) + '/test_helper.rb' | ||
require 'avatar/source/pavatar_source' | ||
|
||
class TestPavatarSource < Test::Unit::TestCase | ||
|
||
def setup | ||
@source = Avatar::Source::PavatarSource.new | ||
@gary = Person.new('antono@example.com', 'Antono Vasiljev', 'http://localhost:4567/') | ||
end | ||
|
||
def test_nil_when_person_is_nil | ||
assert_nil @source.avatar_url_for(nil) | ||
end | ||
|
||
def test_not_nil_when_person_is_not_nil | ||
assert_equal 'http://localhost:4567/pavatar.png', @source.avatar_url_for(@gary) | ||
end | ||
|
||
|
||
end |