Sha256: 5f1f74c4206df34ad1e9ee159c061dbed6dc608c1f837c0bdc7af3f963619623

Contents?: true

Size: 988 Bytes

Versions: 8

Compression:

Stored size: 988 Bytes

Contents

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_partial_path_url
    args = ['www.apple.com/ipad']
    uri = Yawast::Commands::Utils.extract_uri args
    assert_equal uri.to_s, 'http://www.apple.com/ipad/'
  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

8 entries across 8 versions & 1 rubygems

Version Path
yawast-0.7.2 test/test_cmd_util.rb
yawast-0.7.1 test/test_cmd_util.rb
yawast-0.7.0 test/test_cmd_util.rb
yawast-0.7.0.beta3 test/test_cmd_util.rb
yawast-0.7.0.beta2 test/test_cmd_util.rb
yawast-0.7.0.beta1 test/test_cmd_util.rb
yawast-0.6.0 test/test_cmd_util.rb
yawast-0.6.0.beta6 test/test_cmd_util.rb