# 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_raise(ArgumentError) { ShortURL.shorten(@url, :foobar) } end end