Sha256: c33c0d5d891791e71c58153e346113f36ea4de94a37abcd2d295d74c7eba68c3

Contents?: true

Size: 708 Bytes

Versions: 1

Compression:

Stored size: 708 Bytes

Contents

require 'test_helper'
require 'cgi'

class GravatarifyRackVsCgiTest < Test::Unit::TestCase
  include Gravatarify::Base

  # Remove Rack if defined
  def setup
    Object.send(:remove_const, :Rack) if defined?(Rack)    
  end

  # Reload Rack::Utils
  def teardown
    begin; require('rack/utils'); rescue LoadError; end
  end

  context "if Rack::Utils is not available, #gravatar_url" do
    should "fallback to CGI#escape" do
      assert !defined?(Rack::Utils), 'Rack::Utils should no longer be defined'
      assert defined?(CGI), "CGI should be defined"
      assert_equal "#{BELLA_AT_GMAIL_JPG}?escaped%2Fme=escaped%2Fme", gravatar_url('bella@gmail.com', 'escaped/me' => 'escaped/me')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gravatarify-2.0.3 test/unit/gravatarify_rack_vs_cgi_test.rb