Don't attempt to detect version if URL is not set
This commit is contained in:
		
							parent
							
								
									8ebaa9c0a9
								
							
						
					
					
						commit
						62c0a391b4
					
				@ -148,6 +148,8 @@ class Resource
 | 
			
		||||
  private
 | 
			
		||||
 | 
			
		||||
  def detect_version(val)
 | 
			
		||||
    return if val.nil? && url.nil?
 | 
			
		||||
 | 
			
		||||
    case val
 | 
			
		||||
    when nil     then Version.detect(url, specs)
 | 
			
		||||
    when String  then Version.new(val)
 | 
			
		||||
 | 
			
		||||
@ -81,6 +81,10 @@ class ResourceTests < Homebrew::TestCase
 | 
			
		||||
    assert_raises(TypeError) { @resource.version(Object.new) }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_version_when_url_is_not_set
 | 
			
		||||
    assert_nil @resource.version
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_mirrors
 | 
			
		||||
    assert_empty @resource.mirrors
 | 
			
		||||
    @resource.mirror('foo')
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user