gravatar_spec.rb
43 lines
| 1.1 KiB
| text/x-ruby
|
RubyLexer
|
r1960 | require 'rubygems' | ||
require 'erb' # to get "h" | ||||
require 'active_support' # to get "returning" | ||||
require File.dirname(__FILE__) + '/../lib/gravatar' | ||||
include GravatarHelper, GravatarHelper::PublicMethods, ERB::Util | ||||
|
r3958 | describe "gravatar_url with a custom default URL" do | ||
before(:each) do | ||||
|
r1960 | @original_options = DEFAULT_OPTIONS.dup | ||
DEFAULT_OPTIONS[:default] = "no_avatar.png" | ||||
@url = gravatar_url("somewhere") | ||||
end | ||||
|
r3958 | it "should include the \"default\" argument in the result" do | ||
|
r1960 | @url.should match(/&default=no_avatar.png/) | ||
end | ||||
|
r3958 | after(:each) do | ||
|
r1960 | DEFAULT_OPTIONS.merge!(@original_options) | ||
end | ||||
end | ||||
|
r3958 | describe "gravatar_url with default settings" do | ||
before(:each) do | ||||
|
r1960 | @url = gravatar_url("somewhere") | ||
end | ||||
|
r3958 | it "should have a nil default URL" do | ||
|
r1960 | DEFAULT_OPTIONS[:default].should be_nil | ||
end | ||||
|
r3958 | it "should not include the \"default\" argument in the result" do | ||
|
r1960 | @url.should_not match(/&default=/) | ||
end | ||||
|
r3958 | end | ||
describe "gravatar with a custom title option" do | ||||
it "should include the title in the result" do | ||||
gravatar('example@example.com', :title => "This is a title attribute").should match(/This is a title attribute/) | ||||
end | ||||
end | ||||