Sha256: c04b14305e98c0c0224ed4b96f94dc255ccd1b7cd6cd18d21528fd7c6875f420

Contents?: true

Size: 547 Bytes

Versions: 5

Compression:

Stored size: 547 Bytes

Contents

require 'test/unit'
require 'iz'

class TestUrl < Test::Unit::TestCase

  def valid_urls
    ['http://google.com', 'https://google.com', 'http://www.foo.bar', 'https://foo.io', '//google.com.uk']
  end

  def invalid_urls
    [nil, false, -1, '', '1112', 'g', '10101a', 'http://google', 'https://google', 'www.google']
  end

  def test_that_urls_return_true
    valid_urls.each do |url|
      assert Iz.url?(url)
    end
  end

  def test_that_invalid_urls_return_false
    invalid_urls.each do |url|
      assert !Iz.url?(url)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
iz-0.3.1 test/test_url.rb
iz-0.3.0 test/test_url.rb
iz-0.2.1 test/test_url.rb
iz-0.2.0 test/test_url.rb
iz-0.1.0 test/test_url.rb