Sha256: 1a30c0bbce7761c4f3b50eadffa31543f7a51294355f243b0b7a390c65e0b130

Contents?: true

Size: 793 Bytes

Versions: 2

Compression:

Stored size: 793 Bytes

Contents

require 'minitest/autorun'
require './lib/yawast'
require './test/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

2 entries across 2 versions & 1 rubygems

Version Path
yawast-0.2.0.beta2 test/test_cmd_util.rb
yawast-0.2.0.beta1 test/test_cmd_util.rb