Sha256: d7e7451f6dc2f9173254c13c742f2e5c967faee8d0a4ec7310d058b67faa07f9

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

# tc_shortcut.rb
#
#   Created by Vincent Foley on 2005-06-01

$test_lib_dir = File.join(File.dirname(__FILE__), "..", "lib")
$:.unshift($test_lib_dir)

require "test/unit"
require "shorturl"


class TestShortURL < Test::Unit::TestCase
  def setup
    @url = "http://darkhost.mine.nu:81/~vince/rails/tutorial.html"
  end
  
  def test_shorten
    assert ShortURL.shorten(@url) == "http://rubyurl.com/Q9ToW"
    assert ShortURL.shorten(@url, :rubyurl) == "http://rubyurl.com/Q9ToW"
    assert ShortURL.shorten(@url, :tinyurl) == "http://tinyurl.com/9mop8"
    assert ShortURL.shorten(@url, :shorl) =~ /^http:\/\/shorl.com/  # Never the same URL
    assert ShortURL.shorten(@url, :snipurl) == "http://snipurl.com/fbkl"
    assert ShortURL.shorten(@url, :metamark) == "http://xrl.us/ga8c"
    assert ShortURL.shorten(@url, :makeashorterlink) == "http://makeashorterlink.com/?O1752235A"
    assert ShortURL.shorten(@url, :skinnylink) == "http://skinnylink.com?nqvcce"
    assert ShortURL.shorten(@url, :linktrim) =~ /http:\/\/linktrim/ # Never the same URL
    assert ShortURL.shorten(@url, :shorterlink) == "http://shorterlink.com/?PQD096"
    assert ShortURL.shorten(@url, :minilink) == "http://lnk.nu/darkhost.mine.nu:81/2zr.html"
    assert ShortURL.shorten(@url, :lns) == "http://ln-s.net/5UL"
    assert ShortURL.shorten(@url, :fyad) == "http://fyad.org/15zu"

    assert_raise(InvalidService) { ShortURL.shorten(@url, :foobar) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shorturl-0.5.0 test/tc_shorturl.rb