comparison vendor/plugins/gravatar/spec/.svn/text-base/gravatar_spec.rb.svn-base @ 22:40f7cfd4df19

* Update to SVN trunk rev 4173
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 24 Sep 2010 14:06:04 +0100
parents 513646585e45
children
comparison
equal deleted inserted replaced
14:1d32c0a0efbf 22:40f7cfd4df19
2 require 'erb' # to get "h" 2 require 'erb' # to get "h"
3 require 'active_support' # to get "returning" 3 require 'active_support' # to get "returning"
4 require File.dirname(__FILE__) + '/../lib/gravatar' 4 require File.dirname(__FILE__) + '/../lib/gravatar'
5 include GravatarHelper, GravatarHelper::PublicMethods, ERB::Util 5 include GravatarHelper, GravatarHelper::PublicMethods, ERB::Util
6 6
7 context "gravatar_url with a custom default URL" do 7 describe "gravatar_url with a custom default URL" do
8 setup do 8 before(:each) do
9 @original_options = DEFAULT_OPTIONS.dup 9 @original_options = DEFAULT_OPTIONS.dup
10 DEFAULT_OPTIONS[:default] = "no_avatar.png" 10 DEFAULT_OPTIONS[:default] = "no_avatar.png"
11 @url = gravatar_url("somewhere") 11 @url = gravatar_url("somewhere")
12 end 12 end
13 13
14 specify "should include the \"default\" argument in the result" do 14 it "should include the \"default\" argument in the result" do
15 @url.should match(/&default=no_avatar.png/) 15 @url.should match(/&default=no_avatar.png/)
16 end 16 end
17 17
18 teardown do 18 after(:each) do
19 DEFAULT_OPTIONS.merge!(@original_options) 19 DEFAULT_OPTIONS.merge!(@original_options)
20 end 20 end
21 21
22 end 22 end
23 23
24 context "gravatar_url with default settings" do 24 describe "gravatar_url with default settings" do
25 setup do 25 before(:each) do
26 @url = gravatar_url("somewhere") 26 @url = gravatar_url("somewhere")
27 end 27 end
28 28
29 specify "should have a nil default URL" do 29 it "should have a nil default URL" do
30 DEFAULT_OPTIONS[:default].should be_nil 30 DEFAULT_OPTIONS[:default].should be_nil
31 end 31 end
32 32
33 specify "should not include the \"default\" argument in the result" do 33 it "should not include the \"default\" argument in the result" do
34 @url.should_not match(/&default=/) 34 @url.should_not match(/&default=/)
35 end 35 end
36 36
37 end 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