fix for no extract results from uri check

This commit is contained in:
John Bender 2010-03-23 00:03:28 -07:00
parent 2067f000f5
commit 527e101cab
4 changed files with 9 additions and 3 deletions

View File

@ -8,7 +8,8 @@ module Vagrant
def self.match?(uri)
# URI.parse barfs on '<drive letter>:\\files \on\ windows'
URI.extract(uri).first.include?(uri)
uri = URI.extract(uri).first
uri && uri.include?(uri)
end
def download!(source_url, destination_file)

View File

@ -39,6 +39,11 @@ class HttpDownloaderTest < Test::Unit::TestCase
URI.expects(:extract).returns(['foo'])
assert Vagrant::Downloaders::HTTP.match?('foo')
end
should "return false if there are no extract results" do
URI.expects(:extract).returns([])
assert !Vagrant::Downloaders::HTTP.match?('foo')
end
end
context "reporting progress" do