To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / 2e / 2e890aa88f7d83a47f036e36ee54bac43bb88fbe.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (1.15 KB)
| 1 |
require 'rubygems' |
|---|---|
| 2 |
require 'erb' # to get "h" |
| 3 |
require 'active_support' # to get "returning" |
| 4 |
require File.dirname(__FILE__) + '/../lib/gravatar' |
| 5 |
include GravatarHelper, GravatarHelper::PublicMethods, ERB::Util |
| 6 |
|
| 7 |
describe "gravatar_url with a custom default URL" do |
| 8 |
before(:each) do |
| 9 |
@original_options = DEFAULT_OPTIONS.dup |
| 10 |
DEFAULT_OPTIONS[:default] = "no_avatar.png" |
| 11 |
@url = gravatar_url("somewhere")
|
| 12 |
end |
| 13 |
|
| 14 |
it "should include the \"default\" argument in the result" do |
| 15 |
@url.should match(/&default=no_avatar.png/) |
| 16 |
end |
| 17 |
|
| 18 |
after(:each) do |
| 19 |
DEFAULT_OPTIONS.merge!(@original_options) |
| 20 |
end |
| 21 |
|
| 22 |
end |
| 23 |
|
| 24 |
describe "gravatar_url with default settings" do |
| 25 |
before(:each) do |
| 26 |
@url = gravatar_url("somewhere")
|
| 27 |
end |
| 28 |
|
| 29 |
it "should have a nil default URL" do |
| 30 |
DEFAULT_OPTIONS[:default].should be_nil |
| 31 |
end |
| 32 |
|
| 33 |
it "should not include the \"default\" argument in the result" do |
| 34 |
@url.should_not match(/&default=/) |
| 35 |
end |
| 36 |
|
| 37 |
end |
| 38 |
|
| 39 |
describe "gravatar with a custom title option" do |
| 40 |
it "should include the title in the result" do |
| 41 |
gravatar('example@example.com', :title => "This is a title attribute").should match(/This is a title attribute/)
|
| 42 |
end |
| 43 |
end |