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
Search Repo:
francois (author)
Sat Mar 22 19:57:46 -0700 2008
commit  a3c673d0a7b6118f3e0784ddfede04e1510b8b82
tree    9216f98e811fcbd14de6169b6b74fe12e36e07d7
parent  c81aa59f7c99f22b181a27899af6a9eb7944bb91
piston / test / unit / test_git_working_copy_guessing.rb
100644 34 lines (29 sloc) 1.106 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require File.dirname(__FILE__) + "/../test_helper"
 
class TestGitWorkingCopyGuessing < Test::Unit::TestCase
  def setup
    @dir = Pathname.new("tmp/wc")
  end
 
  def test_does_git_status_on_directory
    Dir.expects(:chdir).with(@dir).yields
    Piston::Git::WorkingCopy.expects(:git).with(:status).returns("# On branch master
nothing to commit (working directory clean)
")
    assert Piston::Git::WorkingCopy.understands_dir?(@dir)
  end
 
  def test_does_git_status_on_parent_directories_recursively
    @wc = @dir
    @tmp = @wc.parent
    @root = @tmp.parent
 
    Dir.expects(:chdir).with(@dir).raises(Errno::ENOENT)
    Dir.expects(:chdir).with(@tmp).raises(Errno::ENOENT)
    Dir.expects(:chdir).with(@root).yields
    Piston::Git::WorkingCopy.expects(:git).with(:status).returns("# On branch master
nothing to commit (working directory clean)
")
    assert Piston::Git::WorkingCopy.understands_dir?(@dir)
  end
 
  def test_denies_when_git_unavailable
    Piston::Git::WorkingCopy.stubs(:git).raises(Piston::Git::Client::BadCommand)
    deny Piston::Git::WorkingCopy.understands_dir?(@dir)
  end
end