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
Sat Apr 19 15:03:41 -0700 2008
francois (committer)
Mon Apr 21 13:14:25 -0700 2008
commit  1cef7b69dff6ad3bd62e5127a38f2de73ee89456
tree    531c3f4e39de7494ad28813361de00dc968d7e40
parent  e90f935a38bb88f37da5a3ba849531173c107413
piston / test / unit / git / commit / test_git_commit_each.rb
100644 37 lines (31 sloc) 0.944 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
35
36
37
require File.dirname(__FILE__) + "/../../../test_helper"
require "find"
 
class TestGitCommitEach < Test::Unit::TestCase
  def setup
    @repos = mock("repository")
    @repos.stubs(:url).returns("git://github.com/francois/arepos.git")
 
    @tmpdir = Pathname.new("tmp/.arepos.tmp.git")
    @tmpdir.rmtree rescue nil
    @tmpdir.mkdir
    @commit = Piston::Git::Commit.new(@repos, "ab"*20)
    @commit.stubs(:git).returns("commit " + "ab" * 20)
    @commit.checkout_to(@tmpdir)
  end
 
  def teardown
    @tmpdir.rmtree
  end
 
  def test_prunes_search_tree_on_dot_git_directory
    @tmpdir.expects(:find).yields(@tmpdir + ".git")
    assert_throws :prune do
      @commit.each do |relpath|
        # Can't assert anything
      end
    end
  end
 
  def test_yields_paths_relative_to_working_copy
    @tmpdir.expects(:find).yields(@tmpdir + "a.rb")
    @commit.each do |relpath|
      assert_equal Pathname.new("a.rb"), relpath
    end
  end
end