Sha256: 9487d4ed2d7d0b3cdc7911001a71c9a8808ee4210ffd350053f9844cf080cd6d

Contents?: true

Size: 1.53 KB

Versions: 14

Compression:

Stored size: 1.53 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require File.expand_path('../../../../spec/helper', __FILE__)
require 'ramaze/helper/gravatar'

describe Ramaze::Helper::Gravatar do
  extend Ramaze::Helper::Gravatar

  @email = 'ramaze-spec-gravatar@manveru.oib.com'
  @digest = Digest::MD5.hexdigest(@email)

  def uri(*tail)
    URI("http://www.gravatar.com/avatar/#{@digest}#{tail.join}")
  end

  it 'takes an email and turns it into a hashed part of the uri' do
    gravatar(@email).should == uri
  end

  it 'takes :size option' do
    gravatar(@email, :size => 100).should == uri('?size=100')
  end

  it 'takes :rating option' do
    gravatar(@email, :rating => 'g').should == uri('?rating=g')
    gravatar(@email, :rating => 'pg').should == uri('?rating=pg')
    gravatar(@email, :rating => 'r').should == uri('?rating=r')
    gravatar(@email, :rating => 'x').should == uri('?rating=x')
  end

  it 'takes :default option' do
    gravatar(@email, :default => :identicon).should == uri('?default=identicon')
    gravatar(@email, :default => :monsterid).should == uri('?default=monsterid')
    gravatar(@email, :default => :wavatar).should == uri('?default=wavatar')
    gravatar(@email, :default => 'http://example.com/me.jpg').should == uri('?default=http%3A%2F%2Fexample.com%2Fme.jpg')
  end

  it 'takes :force option' do
    gravatar(@email, :force => true).should == uri('?force=1')
    gravatar(@email, :force => false).should == uri('')
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.06.12 spec/ramaze/helper/gravatar.rb
manveru-ramaze-2009.07 spec/ramaze/helper/gravatar.rb
ramaze-2011.12.28 spec/ramaze/helper/gravatar.rb
ramaze-2011.10.23 spec/ramaze/helper/gravatar.rb
ramaze-2011.07.25 spec/ramaze/helper/gravatar.rb
ramaze-2011.01.30 spec/ramaze/helper/gravatar.rb
ramaze-2011.01 spec/ramaze/helper/gravatar.rb
ramaze-2010.06.18 spec/ramaze/helper/gravatar.rb
ramaze-2010.04.04 spec/ramaze/helper/gravatar.rb
ramaze-2010.04 spec/ramaze/helper/gravatar.rb
ramaze-2010.03 spec/ramaze/helper/gravatar.rb
ramaze-2010.01 spec/ramaze/helper/gravatar.rb
ramaze-2009.10 spec/ramaze/helper/gravatar.rb
ramaze-2009.07 spec/ramaze/helper/gravatar.rb