0
require File.dirname(__FILE__) + "/../test_helper"
0
class TestRepository < Test::Unit::TestCase
0
Piston::Repository.class_variable_set(:@@handlers, [Piston::Git::Repository, Piston::Svn::Repository])
0
@repository = Piston::Repository.new("url")
0
def test_guess_asks_each_handler_in_turn
0
Piston::Repository.send(:handlers).clear
0
Piston::Repository.add_handler(handler = mock("handler"))
0
@@ -28,8 +27,7 @@ class TestRepository < Test::Unit::TestCase
0
Piston::Repository.add_handler handler
0
assert_equal handler_instance, Piston::Repository.guess(url)
0
def test_if_guess_return_GIT_repository_when_url_is_git_repository
0
assert_equal Piston::Git::Repository.new("git://github.com/francois/piston.git"), Piston::Repository.guess("git://github.com/francois/piston.git")
0
@@ -37,38 +35,37 @@ class TestRepository < Test::Unit::TestCase
0
def test_if_guess_return_SVN_repository_when_url_is_svn_repository
0
assert_equal Piston::Svn::Repository.new("svn://svn.com/francois/piston.git"), Piston::Repository.guess("svn://svn.com/francois/piston.git")
0
def test_guess_when_unhandled_url
0
assert_raise(Piston::Repository::UnhandledUrl) { Piston::Repository.guess("invalid") }
0
assert_equal [Piston::Git::Repository, Piston::Svn::Repository], Piston::Repository.handlers
0
before_add = Piston::Repository.class_variable_get(:@@handlers)
0
after_add = before_add << Piston::Git::Repository
0
Piston::Repository.add_handler(Piston::Git::Repository)
0
assert_equal after_add, Piston::Repository.class_variable_get(:@@handlers)
0
assert_equal "url", @repository.instance_variable_get(:@url)
0
assert_equal "url", @repository.url
0
revision = @repository.at("2")
0
assert_equal @repository, revision.repository
0
assert_equal "2", revision.revision
0
assert_equal "Piston::Repository(url)", @repository.to_s
Comments
No one has commented yet.