Sha256: a3c5ddefce6c601f04be90e24b8f442211bb9b2fda62558952afae4d7de5d84f

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

# Unit tests for ImgGravatar
require 'test/unit'
require 'img_gravatar'

class ModuleGravatarTest < Test::Unit::TestCase
  @@gravatar_host = "www.gravatar.com"
  @@base_url = "http://#{@@gravatar_host}/avatar"
  @@ref_mail = "iHaveAn@email.com"
  @@ref_hash = "3b3be63a4c2a439b013787725dfce802"
  
  def test_module_functions
    assert(ImgGravatar.respond_to?('image_url'), 'Module ImgGravatar does not respond to image_url')
    assert(ImgGravatar.respond_to?('link_gravatar'), 'Module ImgGravatar does not respond to link_grevatar')
  end
  
  def test_reference_data
    # the reference data from http://en.gravatar.com/site/implement/url
    link_url = ImgGravatar.link_gravatar(@@ref_mail)
    assert_match(/^<img src="#{@@base_url}\/#{@@ref_hash}\" \/>/, link_url)
    #assert_match(/^<img src="http:\/\/www\.gravatar\.com\/avatar\/#{ref_hash}\" \/>/, link_url)
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
tsalzer-img_gravatar-0.1.1 test/module_gravatar_test.rb
img_gravatar-0.1.1 test/module_gravatar_test.rb