aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorJack Nagel2012-10-15 01:19:31 -0500
committerJack Nagel2012-10-15 17:45:48 -0500
commit39ec66614b183d0784d8a77e93831f04277e07d2 (patch)
treee3f5e08a7e920a19ecf1f642620960bbef54b10c /Library/Homebrew/test
parentbab29bab721860a6f3fee4cc0f546764cda5ce87 (diff)
downloadbrew-39ec66614b183d0784d8a77e93831f04277e07d2.tar.bz2
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 <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_download_strategies.rb19
1 files changed, 19 insertions, 0 deletions
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