public
Description: Piston is a utility that eases vendor branch management. This repository is a complete reimplementation of Piston to provide different backends, depending on the repositories and working copies you pistonize from.
Homepage: http://piston.rubyforge.org/
Clone URL: git://github.com/francois/piston.git
Sun Apr 20 08:50:28 -0700 2008
francois (committer)
Mon Apr 21 13:14:28 -0700 2008
piston / test / unit / git / repository / test_guessing.rb
100644 23 lines (18 sloc) 1.128 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require File.dirname(__FILE__) + "/../../../test_helper"
 
class TestGitRepositoryGuessing < Test::Unit::TestCase
  def test_understands_git_protocol
    assert Piston::Git::Repository.understands_url?("git://github.com/francois/piston.git")
  end
 
  def test_understand_http_when_heads_returned
    Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "http://github.com/francois/piston.git").returns("ab"*20 + " refs/heads/master")
    assert Piston::Git::Repository.understands_url?("http://github.com/francois/piston.git")
  end
 
  def test_does_not_understand_http_when_no_heads
    Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "http://github.com/francois/piston.git").returns("")
    deny Piston::Git::Repository.understands_url?("http://github.com/francois/piston.git")
  end
 
  def test_asks_url_when_ssh_protocol
    Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "ssh://francois@github.com/francois/piston.git").returns("ab"*20 + " refs/heads/master")
    assert Piston::Git::Repository.understands_url?("ssh://francois@github.com/francois/piston.git")
  end
end