blastr 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -1
- data/lib/blastr.rb +1 -1
- data/lib/scm/hg.rb +1 -1
- data/test/test_scm_url_matching.rb +17 -20
- metadata +1 -1
data/History.txt
CHANGED
data/lib/blastr.rb
CHANGED
data/lib/scm/hg.rb
CHANGED
@@ -1,34 +1,31 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper.rb'
|
2
2
|
|
3
3
|
class TestScmURLMatching < Test::Unit::TestCase
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
SVN_URLS = [ SVN_HTTP_URL, SVN_HTTPS_URL, SVN_NATIVE_URL ]
|
10
|
-
ALL_URLS = [ SVN_URLS, GIT_URL, MERCURIAL_URL ].flatten
|
4
|
+
|
5
|
+
GIT_URLS = [ "git://foo.com/bar.git" ]
|
6
|
+
MERCURIAL_URLS = [ "hg:http://foo.com/hg", "hg:/tmp/hg/repo" ]
|
7
|
+
SVN_URLS = [ "http://foo.com/svn", "https://foo.com/svn", "svn://foo.com/svn" ]
|
8
|
+
ALL_URLS = [ SVN_URLS, GIT_URLS, MERCURIAL_URLS ].flatten
|
11
9
|
|
12
10
|
def test_subversion
|
13
|
-
SVN_URLS
|
14
|
-
assert Blastr::SourceControl::Subversion.understands_url?(url), "#{url} should be a Subversion URL!"
|
15
|
-
end
|
16
|
-
ALL_URLS.reject {|url| SVN_URLS.include?(url) }.each do |url|
|
17
|
-
assert Blastr::SourceControl::Subversion.understands_url?(url) == false, "#{url} should not be a Subversion URL!"
|
18
|
-
end
|
11
|
+
assert_urls_are_understood_by(Blastr::SourceControl::Subversion, SVN_URLS)
|
19
12
|
end
|
20
13
|
|
21
14
|
def test_git
|
22
|
-
|
23
|
-
ALL_URLS.reject {|url| url == GIT_URL }.each do |url|
|
24
|
-
assert Blastr::SourceControl::Git.understands_url?(url) == false, "#{url} should not be a Git URL!"
|
25
|
-
end
|
15
|
+
assert_urls_are_understood_by(Blastr::SourceControl::Git, GIT_URLS)
|
26
16
|
end
|
27
17
|
|
28
18
|
def test_mercurial
|
29
|
-
|
30
|
-
|
31
|
-
|
19
|
+
assert_urls_are_understood_by(Blastr::SourceControl::Mercurial, MERCURIAL_URLS)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def assert_urls_are_understood_by(scm, list_of_urls)
|
24
|
+
list_of_urls.each do |url|
|
25
|
+
assert scm.understands_url?(url), "#{url} should be understood by #{scm}!"
|
26
|
+
end
|
27
|
+
ALL_URLS.reject {|url| list_of_urls.include?(url) }.each do |url|
|
28
|
+
assert scm.understands_url?(url) == false, "#{url} should not be understood by #{scm}!"
|
32
29
|
end
|
33
30
|
end
|
34
31
|
end
|