test/test_SiteFuelRuntime.rb in sitefuel-0.0.0b vs test/test_SiteFuelRuntime.rb in sitefuel-0.1.0a
- old
+ new
@@ -1,10 +1,10 @@
#
-# File:: test_SiteFuelRuntime.m
-# Author:: wkm
-# Copyright:: 2009
-# License:: GPL
+# File:: test_SiteFuelRuntime.m
+# Author:: wkm
+# Copyright:: 2009, Zanoccio LLC.
+# License:: GPL version 2.0 (see LICENSE.rb)
#
# Unit tests for the SiteFuelRuntime class.
#
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
@@ -89,8 +89,46 @@
@runtime.choose_processor!("foo.html")
end
assert_equal warnings+1, SiteFuelLogger.instance.warn_count
assert_equal Processor::HTMLProcessor, @runtime.choose_processor("foo.htm")
+ end
+
+
+ def test_repository_system_classification
+ assert_equal :git, @runtime.classify_repository_system('ssh://host/path/repo.git')
+ assert_equal :git, @runtime.classify_repository_system('SSH://host/path/repo.git')
+ assert_equal :git, @runtime.classify_repository_system('git://host/path/repo')
+ assert_equal :git, @runtime.classify_repository_system('GIT://host/path/repo')
+ assert_equal :git, @runtime.classify_repository_system('rsync://host/path/repo')
+ assert_equal :git, @runtime.classify_repository_system('RSYNC://host/path/repo')
+
+
+ assert_equal :svn, @runtime.classify_repository_system('svn+ssh://host/path/repo')
+ assert_equal :svn, @runtime.classify_repository_system('SVN+ssh://host/path/repo')
+ assert_equal :svn, @runtime.classify_repository_system('SVN://host/path/repo')
+ assert_equal :svn, @runtime.classify_repository_system('svn://host/path/repo')
+ assert_equal :svn, @runtime.classify_repository_system('FILE://path/repo')
+ assert_equal :svn, @runtime.classify_repository_system('file:///path/repo')
+
+ # if it ends with .git, it's GIT
+ assert_equal :git, @runtime.classify_repository_system('host/path/repo.git')
+ assert_equal :git, @runtime.classify_repository_system('http://host/path/repo.git')
+ assert_equal :git, @runtime.classify_repository_system('https://host/path/repo.git')
+
+ # vanilla file system deployments
+ assert_equal :filesystem, @runtime.classify_repository_system('./dir')
+ assert_equal :filesystem, @runtime.classify_repository_system('/var/www/dir')
+ assert_equal :filesystem, @runtime.classify_repository_system('dir/')
+ assert_equal :filesystem, @runtime.classify_repository_system('../.dir/')
+ assert_equal :filesystem, @runtime.classify_repository_system('../.dir/somehandle')
+
+ # these shouldn't be classified, or are ambiguous
+ assert_raises(UnknownVersioningSystem) do
+ @runtime.classify_repository_system('http://host/repo')
+ end
+ assert_raises(UnknownVersioningSystem) do
+ @runtime.classify_repository_system('https://host/repo')
+ end
end
end
\ No newline at end of file