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