From 761acc47a73bbbf214bda52efbb4500e9560c6da Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 15 Oct 2012 01:19:31 -0500 Subject: Test coverage for DownloadStrategyDetector While at it, make it use class methods instead; no reason to instantiate an object for this. Eventually there should be some functional tests for the individual strategies as well. Signed-off-by: Jack Nagel --- Library/Homebrew/test/test_download_strategies.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Library/Homebrew/test/test_download_strategies.rb (limited to 'Library/Homebrew/test') diff --git a/Library/Homebrew/test/test_download_strategies.rb b/Library/Homebrew/test/test_download_strategies.rb new file mode 100644 index 000000000..13392272b --- /dev/null +++ b/Library/Homebrew/test/test_download_strategies.rb @@ -0,0 +1,19 @@ +require 'testing_env' +require 'download_strategy' +require 'bottles' # XXX: hoist these regexps into constants in Pathname? + +class DownloadStrategyDetectorTests < Test::Unit::TestCase + def setup + @d = DownloadStrategyDetector.new + end + + def test_detect_git_download_startegy + @d = DownloadStrategyDetector.detect("git://foo.com/bar.git") + assert_equal GitDownloadStrategy, @d + end + + def test_default_to_curl_strategy + @d = DownloadStrategyDetector.detect(Object.new) + assert_equal CurlDownloadStrategy, @d + end +end -- cgit v1.2.3