Mercurial > hg > soundsoftware-site
annotate lib/plugins/gravatar/spec/gravatar_spec.rb @ 1516:b450a9d58aed redmine-2.4
Update to Redmine SVN revision 13356 on 2.4-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:28:31 +0100 |
parents | 433d4f72a19b |
children |
rev | line source |
---|---|
Chris@0 | 1 require 'rubygems' |
Chris@0 | 2 require 'erb' # to get "h" |
Chris@0 | 3 require 'active_support' # to get "returning" |
Chris@0 | 4 require File.dirname(__FILE__) + '/../lib/gravatar' |
Chris@0 | 5 include GravatarHelper, GravatarHelper::PublicMethods, ERB::Util |
Chris@0 | 6 |
chris@22 | 7 describe "gravatar_url with a custom default URL" do |
chris@22 | 8 before(:each) do |
Chris@0 | 9 @original_options = DEFAULT_OPTIONS.dup |
Chris@0 | 10 DEFAULT_OPTIONS[:default] = "no_avatar.png" |
Chris@0 | 11 @url = gravatar_url("somewhere") |
Chris@0 | 12 end |
Chris@0 | 13 |
chris@22 | 14 it "should include the \"default\" argument in the result" do |
Chris@0 | 15 @url.should match(/&default=no_avatar.png/) |
Chris@0 | 16 end |
Chris@0 | 17 |
chris@22 | 18 after(:each) do |
Chris@0 | 19 DEFAULT_OPTIONS.merge!(@original_options) |
Chris@0 | 20 end |
Chris@0 | 21 |
Chris@0 | 22 end |
Chris@0 | 23 |
chris@22 | 24 describe "gravatar_url with default settings" do |
chris@22 | 25 before(:each) do |
Chris@0 | 26 @url = gravatar_url("somewhere") |
Chris@0 | 27 end |
Chris@0 | 28 |
chris@22 | 29 it "should have a nil default URL" do |
Chris@0 | 30 DEFAULT_OPTIONS[:default].should be_nil |
Chris@0 | 31 end |
Chris@0 | 32 |
chris@22 | 33 it "should not include the \"default\" argument in the result" do |
Chris@0 | 34 @url.should_not match(/&default=/) |
Chris@0 | 35 end |
Chris@0 | 36 |
chris@22 | 37 end |
chris@22 | 38 |
chris@22 | 39 describe "gravatar with a custom title option" do |
chris@22 | 40 it "should include the title in the result" do |
chris@22 | 41 gravatar('example@example.com', :title => "This is a title attribute").should match(/This is a title attribute/) |
chris@22 | 42 end |
chris@22 | 43 end |