Sha256: 24b394e9e7ff2b5a376b0f2ba1b00736d69caaee8dbfb4fc4b591becb4bbedc0

Contents?: true

Size: 722 Bytes

Versions: 2

Compression:

Stored size: 722 Bytes

Contents

require 'test_helper'
require 'cgi'

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

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

  context "if Rack::Utils is not available, #gravatarify" do
    setup do
      # Remove Rack if defined
      Object.send(:remove_const, :Rack) if defined?(Rack)
    end
    
    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", build_gravatar_url('bella@gmail.com', 'escaped/me' => 'escaped/me')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gravatarify-1.2.1 test/unit/gravatarify_rack_vs_cgi_test.rb
gravatarify-1.2.0 test/unit/gravatarify_rack_vs_cgi_test.rb