Sha256: 515d3d9cda007e1e3c4d245640b4323834d5c4c1ef565bd13830a538d6d77a81

Contents?: true

Size: 839 Bytes

Versions: 10

Compression:

Stored size: 839 Bytes

Contents

require 'minitest/autorun'
require File.dirname(__FILE__) + '/../lib/yawast'
require File.dirname(__FILE__) + '/base'

class TestCommandUtils < Minitest::Test
  include TestBase

  def test_valid_url
    args = ['http://www.apple.com']
    uri = Yawast::Commands::Utils.extract_uri args
    assert_equal uri.to_s, 'http://www.apple.com/'
  end

  def test_partial_url
    args = ['www.apple.com']
    uri = Yawast::Commands::Utils.extract_uri args
    assert_equal uri.to_s, 'http://www.apple.com/'
  end

  def test_invalid_url
    args = ['xxx:\invalid']

    assert_raises URI::InvalidURIError do
      Yawast::Commands::Utils.extract_uri args
    end
  end

  def test_unresolvable_url
    args = ['http://www.gjhgjhbmnbmnvgccf.com']

    assert_raises ArgumentError do
      Yawast::Commands::Utils.extract_uri args
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
yawast-0.4.0.beta4 test/test_cmd_util.rb
yawast-0.4.0.beta3 test/test_cmd_util.rb
yawast-0.4.0.beta2 test/test_cmd_util.rb
yawast-0.4.0.beta1 test/test_cmd_util.rb
yawast-0.3.0 test/test_cmd_util.rb
yawast-0.3.0.beta2 test/test_cmd_util.rb
yawast-0.3.0.beta1 test/test_cmd_util.rb
yawast-0.2.2 test/test_cmd_util.rb
yawast-0.2.1 test/test_cmd_util.rb
yawast-0.2.0.beta3 test/test_cmd_util.rb