Sha256: 547666320c8064d5d7c8fdd6dd8e099f4d41ac6609886d364b0dcf7f2cea5477

Contents?: true

Size: 856 Bytes

Versions: 11

Compression:

Stored size: 856 Bytes

Contents

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

require "test/unit"
require "longurl/exceptions"
require "longurl/service"

class TestService < Test::Unit::TestCase
  
  def setup
    @service = LongURL::Service.new
  end
  
  def test_query_should_raise_invalid_url_if_url_is_nil
    assert_raise(LongURL::InvalidURL) { @service.query(nil) }
  end

  def test_query_should_raise_invalid_url_if_url_is_empty
    assert_raise(LongURL::InvalidURL) { @service.query('') }
  end

  def test_query_should_returns_given_url_if_not_shorten_url
    assert_equal "http://www.google.com", @service.query("http://www.google.com")
  end
  
  def test_query_should_returns_expanded_url_for_supported_services
    ShortToLong.each_value {|service| service.each {|short, long| assert_equal long, @service.query(short)}}
  end
end

Version data entries

11 entries across 11 versions & 4 rubygems

Version Path
chuyeow-longurl-0.1.5 test/service/service_test.rb
jakimowicz-longurl-0.1.3 test/service/service_test.rb
jakimowicz-longurl-0.1.4 test/service/service_test.rb
jakimowicz-longurl-0.1.5 test/service/service_test.rb
jakimowicz-longurl-0.1.6 test/service/service_test.rb
ivey-longurl-0.1.7 test/service/service_test.rb
longurl-0.1.6 test/service/service_test.rb
longurl-0.1.2 test/service/service_test.rb
longurl-0.1.5 test/service/service_test.rb
longurl-0.1.4 test/service/service_test.rb
longurl-0.1.3 test/service/service_test.rb