Sha256: e4c7e7939907ded02bf4377f5f751e27ed77708c6c7373fb0af5e9255939131b
Contents?: true
Size: 834 Bytes
Versions: 1
Compression:
Stored size: 834 Bytes
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 String def url? self[0..6].downcase == "http://" end end class TestShortURL < Test::Unit::TestCase include WWW def setup @url = "http://groups.google.com/group/comp.lang.ruby/" end def test_shorten # Default service (RubyURL) assert ShortURL.shorten(@url).url? # All the services (I can't test exact URLs since they seem to # change semi regularly) ShortURL.valid_services.each do |service| puts "Testing #{service}" assert ShortURL.shorten(@url, service).url? end # An invalid service assert_raise(InvalidService) { ShortURL.shorten(@url, :foobar) } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shorturl-0.8.2 | test/tc_shorturl.rb |