public this repo is viewable by everyone
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
Shortening test file names.
26 days ago
francois (committer)
25 days ago
commit  9cfa8f32cfb975bc1ce32746c4567b9b3915ea45
tree    b265bb00ee4b265f8c0ce1075491bbe4a36eaab9
parent  1cef7b69dff6ad3bd62e5127a38f2de73ee89456
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
0
@@ -0,0 +1,29 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitCommitCheckout < Test::Unit::TestCase
0
+ def setup
0
+ @repos = mock("repos")
0
+ @repos.stubs(:url).returns("git://a.repos.com/project.git")
0
+ @reposdir = Pathname.new("tmp/.repos.tmp.git")
0
+ end
0
+
0
+ def test_clones_repository_at_indicated_path
0
+ @sha1 = "a9302"
0
+ @commit = Piston::Git::Commit.new(@repos, @sha1)
0
+ @commit.expects(:git).with(:clone, @repos.url, @reposdir)
0
+ @commit.expects(:git).with(:checkout, "-b", "my-#{@sha1}", @sha1)
0
+ Dir.expects(:chdir).with(@reposdir).yields
0
+ @commit.checkout_to(@reposdir)
0
+ end
0
+
0
+ def test_cloning_head_finds_head_commit
0
+ @sha1 = "HEAD"
0
+ @commit = Piston::Git::Commit.new(@repos, @sha1)
0
+ @commit.expects(:git).with(:clone, @repos.url, @reposdir)
0
+ @commit.expects(:git).with(:checkout, "-b", "my-#{@sha1}", @sha1)
0
+ @commit.expects(:git).with(:log, "-n", "1").returns("commit 922b12a6bcbb6f6a2cec60bcf5de17118086080a\nAuthor: Fran\303\247ois Beausoleil <francois@teksol.info>\nDate: Fri Mar 14 13:28:41 2008 -0400\n\n Changed how dependencies are found and managed, by using config/requirements.rb everywhere.\n \n Updated test/test_helper.rb where appropriate.\n")
0
+ Dir.expects(:chdir).with(@reposdir).yields
0
+ @commit.checkout_to(@reposdir)
0
+ assert_equal "922b12a6bcbb6f6a2cec60bcf5de17118086080a", @commit.revision
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
0
@@ -0,0 +1,36 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+require "find"
0
+
0
+class TestGitCommitEach < Test::Unit::TestCase
0
+ def setup
0
+ @repos = mock("repository")
0
+ @repos.stubs(:url).returns("git://github.com/francois/arepos.git")
0
+
0
+ @tmpdir = Pathname.new("tmp/.arepos.tmp.git")
0
+ @tmpdir.rmtree rescue nil
0
+ @tmpdir.mkdir
0
+ @commit = Piston::Git::Commit.new(@repos, "ab"*20)
0
+ @commit.stubs(:git).returns("commit " + "ab" * 20)
0
+ @commit.checkout_to(@tmpdir)
0
+ end
0
+
0
+ def teardown
0
+ @tmpdir.rmtree
0
+ end
0
+
0
+ def test_prunes_search_tree_on_dot_git_directory
0
+ @tmpdir.expects(:find).yields(@tmpdir + ".git")
0
+ assert_throws :prune do
0
+ @commit.each do |relpath|
0
+ # Can't assert anything
0
+ end
0
+ end
0
+ end
0
+
0
+ def test_yields_paths_relative_to_working_copy
0
+ @tmpdir.expects(:find).yields(@tmpdir + "a.rb")
0
+ @commit.each do |relpath|
0
+ assert_equal Pathname.new("a.rb"), relpath
0
+ end
0
+ end
0
+end
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,29 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitCommitCheckout < Test::Unit::TestCase
0
- def setup
0
- @repos = mock("repos")
0
- @repos.stubs(:url).returns("git://a.repos.com/project.git")
0
- @reposdir = Pathname.new("tmp/.repos.tmp.git")
0
- end
0
-
0
- def test_clones_repository_at_indicated_path
0
- @sha1 = "a9302"
0
- @commit = Piston::Git::Commit.new(@repos, @sha1)
0
- @commit.expects(:git).with(:clone, @repos.url, @reposdir)
0
- @commit.expects(:git).with(:checkout, "-b", "my-#{@sha1}", @sha1)
0
- Dir.expects(:chdir).with(@reposdir).yields
0
- @commit.checkout_to(@reposdir)
0
- end
0
-
0
- def test_cloning_head_finds_head_commit
0
- @sha1 = "HEAD"
0
- @commit = Piston::Git::Commit.new(@repos, @sha1)
0
- @commit.expects(:git).with(:clone, @repos.url, @reposdir)
0
- @commit.expects(:git).with(:checkout, "-b", "my-#{@sha1}", @sha1)
0
- @commit.expects(:git).with(:log, "-n", "1").returns("commit 922b12a6bcbb6f6a2cec60bcf5de17118086080a\nAuthor: Fran\303\247ois Beausoleil <francois@teksol.info>\nDate: Fri Mar 14 13:28:41 2008 -0400\n\n Changed how dependencies are found and managed, by using config/requirements.rb everywhere.\n \n Updated test/test_helper.rb where appropriate.\n")
0
- Dir.expects(:chdir).with(@reposdir).yields
0
- @commit.checkout_to(@reposdir)
0
- assert_equal "922b12a6bcbb6f6a2cec60bcf5de17118086080a", @commit.revision
0
- end
0
-end
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,36 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-require "find"
0
-
0
-class TestGitCommitEach < Test::Unit::TestCase
0
- def setup
0
- @repos = mock("repository")
0
- @repos.stubs(:url).returns("git://github.com/francois/arepos.git")
0
-
0
- @tmpdir = Pathname.new("tmp/.arepos.tmp.git")
0
- @tmpdir.rmtree rescue nil
0
- @tmpdir.mkdir
0
- @commit = Piston::Git::Commit.new(@repos, "ab"*20)
0
- @commit.stubs(:git).returns("commit " + "ab" * 20)
0
- @commit.checkout_to(@tmpdir)
0
- end
0
-
0
- def teardown
0
- @tmpdir.rmtree
0
- end
0
-
0
- def test_prunes_search_tree_on_dot_git_directory
0
- @tmpdir.expects(:find).yields(@tmpdir + ".git")
0
- assert_throws :prune do
0
- @commit.each do |relpath|
0
- # Can't assert anything
0
- end
0
- end
0
- end
0
-
0
- def test_yields_paths_relative_to_working_copy
0
- @tmpdir.expects(:find).yields(@tmpdir + "a.rb")
0
- @commit.each do |relpath|
0
- assert_equal Pathname.new("a.rb"), relpath
0
- end
0
- end
0
-end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,16 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitCommitRememberance < Test::Unit::TestCase
0
- def setup
0
- @repos = mock("repository")
0
- @repos.stubs(:url).returns("git://github.com/francois/arepos.git")
0
-
0
- @reposdir = Pathname.new("tmp/repos.git")
0
- @commit = Piston::Git::Commit.new(@repos, "ab"*20)
0
- @values = @commit.remember_values
0
- end
0
-
0
- def test_remembers_original_commit
0
- assert_equal @values[Piston::Git::COMMIT], @commit.commit
0
- end
0
-end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
0
@@ -0,0 +1,16 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitCommitRememberance < Test::Unit::TestCase
0
+ def setup
0
+ @repos = mock("repository")
0
+ @repos.stubs(:url).returns("git://github.com/francois/arepos.git")
0
+
0
+ @reposdir = Pathname.new("tmp/repos.git")
0
+ @commit = Piston::Git::Commit.new(@repos, "ab"*20)
0
+ @values = @commit.remember_values
0
+ end
0
+
0
+ def test_remembers_original_commit
0
+ assert_equal @values[Piston::Git::COMMIT], @commit.commit
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
0
@@ -0,0 +1,22 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitRepositoryAt < Test::Unit::TestCase
0
+ def setup
0
+ @repos = Piston::Git::Repository.new("git://a.repos.com/project.git")
0
+ end
0
+
0
+ def test_returns_a_piston_git_commit
0
+ Piston::Git::Commit.expects(:new).with(@repos, "a93029").returns(commit = mock("commit"))
0
+ assert_equal commit, @repos.at("a93029")
0
+ end
0
+
0
+ def test_returns_a_piston_git_commit_at_head_when_appropriate
0
+ Piston::Git::Commit.expects(:new).with(@repos, "HEAD").returns(commit = mock("commit"))
0
+ assert_equal commit, @repos.at(:head)
0
+ end
0
+
0
+ def test_returns_a_git_commit_using_recalled_values
0
+ Piston::Git::Commit.expects(:new).with(@repos, "a"*40).returns(commit = mock("commit"))
0
+ assert_equal commit, @repos.at(Piston::Git::COMMIT => "a"*40)
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
0
@@ -0,0 +1,12 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitRepositoryBasename < Test::Unit::TestCase
0
+ def test_basename_is_urls_last_component_minus_dot_git
0
+ assert_equal "piston", basename("git://github.com/francois/piston.git")
0
+ end
0
+
0
+ private
0
+ def basename(url)
0
+ Piston::Git::Repository.new(url).basename
0
+ end
0
+end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,22 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitRepositoryAt < Test::Unit::TestCase
0
- def setup
0
- @repos = Piston::Git::Repository.new("git://a.repos.com/project.git")
0
- end
0
-
0
- def test_returns_a_piston_git_commit
0
- Piston::Git::Commit.expects(:new).with(@repos, "a93029").returns(commit = mock("commit"))
0
- assert_equal commit, @repos.at("a93029")
0
- end
0
-
0
- def test_returns_a_piston_git_commit_at_head_when_appropriate
0
- Piston::Git::Commit.expects(:new).with(@repos, "HEAD").returns(commit = mock("commit"))
0
- assert_equal commit, @repos.at(:head)
0
- end
0
-
0
- def test_returns_a_git_commit_using_recalled_values
0
- Piston::Git::Commit.expects(:new).with(@repos, "a"*40).returns(commit = mock("commit"))
0
- assert_equal commit, @repos.at(Piston::Git::COMMIT => "a"*40)
0
- end
0
-end
...
1
2
3
4
5
6
7
8
9
10
11
12
...
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,12 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitRepositoryBasename < Test::Unit::TestCase
0
- def test_basename_is_urls_last_component_minus_dot_git
0
- assert_equal "piston", basename("git://github.com/francois/piston.git")
0
- end
0
-
0
- private
0
- def basename(url)
0
- Piston::Git::Repository.new(url).basename
0
- end
0
-end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,22 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitRepositoryGuessing < Test::Unit::TestCase
0
- def test_understands_git_protocol
0
- assert Piston::Git::Repository.understands_url?("git://github.com/francois/piston.git")
0
- end
0
-
0
- def test_understand_http_when_heads_returned
0
- Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "http://github.com/francois/piston.git").returns("ab"*20 + " refs/heads/master")
0
- assert Piston::Git::Repository.understands_url?("http://github.com/francois/piston.git")
0
- end
0
-
0
- def test_does_not_understand_http_when_no_heads
0
- Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "http://github.com/francois/piston.git").returns("")
0
- deny Piston::Git::Repository.understands_url?("http://github.com/francois/piston.git")
0
- end
0
-
0
- def test_asks_url_when_ssh_protocol
0
- Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "ssh://francois@github.com/francois/piston.git").returns("ab"*20 + " refs/heads/master")
0
- assert Piston::Git::Repository.understands_url?("ssh://francois@github.com/francois/piston.git")
0
- end
0
-end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
0
@@ -0,0 +1,22 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitRepositoryGuessing < Test::Unit::TestCase
0
+ def test_understands_git_protocol
0
+ assert Piston::Git::Repository.understands_url?("git://github.com/francois/piston.git")
0
+ end
0
+
0
+ def test_understand_http_when_heads_returned
0
+ Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "http://github.com/francois/piston.git").returns("ab"*20 + " refs/heads/master")
0
+ assert Piston::Git::Repository.understands_url?("http://github.com/francois/piston.git")
0
+ end
0
+
0
+ def test_does_not_understand_http_when_no_heads
0
+ Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "http://github.com/francois/piston.git").returns("")
0
+ deny Piston::Git::Repository.understands_url?("http://github.com/francois/piston.git")
0
+ end
0
+
0
+ def test_asks_url_when_ssh_protocol
0
+ Piston::Git::Repository.expects(:git).with("ls-remote", "--heads", "ssh://francois@github.com/francois/piston.git").returns("ab"*20 + " refs/heads/master")
0
+ assert Piston::Git::Repository.understands_url?("ssh://francois@github.com/francois/piston.git")
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
0
@@ -0,0 +1,28 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitWorkingCopyCopying < Test::Unit::TestCase
0
+ def setup
0
+ @wcdir = Pathname.new("tmp/wc")
0
+ @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
+ @wc.stubs(:git)
0
+ end
0
+
0
+ def teardown
0
+ @wcdir.rmtree rescue nil
0
+ end
0
+
0
+ def test_copies_file
0
+ files = ["file.rb"]
0
+ files.expects(:copy_to).with("file.rb", @wcdir + files.first)
0
+ @wc.copy_from(files)
0
+ end
0
+
0
+ def test_ensures_directories_are_created
0
+ files = ["file/a.rb"]
0
+ @wcdir.expects(:+).with(files.first).returns(target = mock("target"))
0
+ target.expects(:dirname).returns(target)
0
+ target.expects(:mkdir)
0
+ files.expects(:copy_to).with("file/a.rb", target)
0
+ @wc.copy_from(files)
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
0
@@ -0,0 +1,26 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitWorkingCopyCreation < Test::Unit::TestCase
0
+ def setup
0
+ @wcdir = Pathname.new("tmp/wc")
0
+ @wcdir.rmtree rescue nil
0
+ @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
+ @wc.stubs(:git)
0
+ end
0
+
0
+ def teardown
0
+ @wcdir.rmtree rescue nil
0
+ end
0
+
0
+ def test_create_does_a_simple_mkpath
0
+ @wcdir.expects(:mkpath)
0
+ @wc.create
0
+ end
0
+
0
+ def test_create_succeeds_even_if_mkpath_fails
0
+ @wcdir.expects(:mkpath).raises(Errno::EEXIST)
0
+ assert_nothing_raised do
0
+ @wc.create
0
+ end
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
0
@@ -0,0 +1,21 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitWorkingCopyExistence < Test::Unit::TestCase
0
+ def setup
0
+ @wcdir = Pathname.new("tmp/wc")
0
+ @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
+ end
0
+
0
+ def teardown
0
+ @wcdir.rmtree rescue nil
0
+ end
0
+
0
+ def test_exist_false_when_no_dir
0
+ deny @wc.exist?
0
+ end
0
+
0
+ def test_exist_true_when_dir_present
0
+ @wcdir.mkdir
0
+ assert @wc.exist?
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
0
@@ -0,0 +1,18 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitWorkingCopyFinalization < Test::Unit::TestCase
0
+ def setup
0
+ @wcdir = Pathname.new("tmp/wc")
0
+ @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
+ end
0
+
0
+ def teardown
0
+ @wcdir.rmtree rescue nil
0
+ end
0
+
0
+ def test_finalize_adds_path_to_git
0
+ Dir.expects(:chdir).with(@wcdir).yields
0
+ @wc.expects(:git).with(:add, ".")
0
+ @wc.finalize
0
+ end
0
+end
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,28 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitWorkingCopyCopying < Test::Unit::TestCase
0
- def setup
0
- @wcdir = Pathname.new("tmp/wc")
0
- @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
- @wc.stubs(:git)
0
- end
0
-
0
- def teardown
0
- @wcdir.rmtree rescue nil
0
- end
0
-
0
- def test_copies_file
0
- files = ["file.rb"]
0
- files.expects(:copy_to).with("file.rb", @wcdir + files.first)
0
- @wc.copy_from(files)
0
- end
0
-
0
- def test_ensures_directories_are_created
0
- files = ["file/a.rb"]
0
- @wcdir.expects(:+).with(files.first).returns(target = mock("target"))
0
- target.expects(:dirname).returns(target)
0
- target.expects(:mkdir)
0
- files.expects(:copy_to).with("file/a.rb", target)
0
- @wc.copy_from(files)
0
- end
0
-end
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,26 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitWorkingCopyCreation < Test::Unit::TestCase
0
- def setup
0
- @wcdir = Pathname.new("tmp/wc")
0
- @wcdir.rmtree rescue nil
0
- @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
- @wc.stubs(:git)
0
- end
0
-
0
- def teardown
0
- @wcdir.rmtree rescue nil
0
- end
0
-
0
- def test_create_does_a_simple_mkpath
0
- @wcdir.expects(:mkpath)
0
- @wc.create
0
- end
0
-
0
- def test_create_succeeds_even_if_mkpath_fails
0
- @wcdir.expects(:mkpath).raises(Errno::EEXIST)
0
- assert_nothing_raised do
0
- @wc.create
0
- end
0
- end
0
-end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,21 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitWorkingCopyExistence < Test::Unit::TestCase
0
- def setup
0
- @wcdir = Pathname.new("tmp/wc")
0
- @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
- end
0
-
0
- def teardown
0
- @wcdir.rmtree rescue nil
0
- end
0
-
0
- def test_exist_false_when_no_dir
0
- deny @wc.exist?
0
- end
0
-
0
- def test_exist_true_when_dir_present
0
- @wcdir.mkdir
0
- assert @wc.exist?
0
- end
0
-end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,18 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitWorkingCopyFinalization < Test::Unit::TestCase
0
- def setup
0
- @wcdir = Pathname.new("tmp/wc")
0
- @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
- end
0
-
0
- def teardown
0
- @wcdir.rmtree rescue nil
0
- end
0
-
0
- def test_finalize_adds_path_to_git
0
- Dir.expects(:chdir).with(@wcdir).yields
0
- @wc.expects(:git).with(:add, ".")
0
- @wc.finalize
0
- end
0
-end
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,34 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitWorkingCopyGuessing < Test::Unit::TestCase
0
- def setup
0
- @dir = Pathname.new("tmp/wc")
0
- end
0
-
0
- def test_does_git_status_on_directory
0
- Dir.expects(:chdir).with(@dir).yields
0
- Piston::Git::WorkingCopy.expects(:git).with(:status).returns("# On branch master
0
-nothing to commit (working directory clean)
0
-")
0
- assert Piston::Git::WorkingCopy.understands_dir?(@dir)
0
- end
0
-
0
- def test_does_git_status_on_parent_directories_recursively
0
- @wc = @dir
0
- @tmp = @wc.parent
0
- @root = @tmp.parent
0
-
0
- Dir.expects(:chdir).with(@dir).raises(Errno::ENOENT)
0
- Dir.expects(:chdir).with(@tmp).raises(Errno::ENOENT)
0
- Dir.expects(:chdir).with(@root).yields
0
- Piston::Git::WorkingCopy.expects(:git).with(:status).returns("# On branch master
0
-nothing to commit (working directory clean)
0
-")
0
- assert Piston::Git::WorkingCopy.understands_dir?(@dir)
0
- end
0
-
0
- def test_denies_when_git_unavailable
0
- Piston::Git::WorkingCopy.stubs(:git).raises(Piston::Git::Client::BadCommand)
0
- deny Piston::Git::WorkingCopy.understands_dir?(@dir)
0
- end
0
-end
...
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
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,25 +0,0 @@
0
-require File.dirname(__FILE__) + "/../../../test_helper"
0
-
0
-class TestGitWorkingCopyRememberance < Test::Unit::TestCase
0
- def setup
0
- @wcdir = Pathname.new("tmp/wc")
0
- @wcdir.mkdir rescue nil
0
- @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
- end
0
-
0
- def teardown
0
- @wcdir.rmtree
0
- end
0
-
0
- def test_creates_dot_piston_dot_yml_file
0
- @wc.remember({}, "a" => "b")
0
- assert((@wcdir + ".piston.yml").exist?)
0
- end
0
-
0
- def test_writes_values_as_yaml_under_handler_key
0
- expected = {"a" => "b"}
0
- @wc.remember({}, expected)
0
- actual = YAML.load((@wcdir + ".piston.yml").read)
0
- assert_equal expected, actual["handler"]
0
- end
0
-end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
0
@@ -0,0 +1,34 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitWorkingCopyGuessing < Test::Unit::TestCase
0
+ def setup
0
+ @dir = Pathname.new("tmp/wc")
0
+ end
0
+
0
+ def test_does_git_status_on_directory
0
+ Dir.expects(:chdir).with(@dir).yields
0
+ Piston::Git::WorkingCopy.expects(:git).with(:status).returns("# On branch master
0
+nothing to commit (working directory clean)
0
+")
0
+ assert Piston::Git::WorkingCopy.understands_dir?(@dir)
0
+ end
0
+
0
+ def test_does_git_status_on_parent_directories_recursively
0
+ @wc = @dir
0
+ @tmp = @wc.parent
0
+ @root = @tmp.parent
0
+
0
+ Dir.expects(:chdir).with(@dir).raises(Errno::ENOENT)
0
+ Dir.expects(:chdir).with(@tmp).raises(Errno::ENOENT)
0
+ Dir.expects(:chdir).with(@root).yields
0
+ Piston::Git::WorkingCopy.expects(:git).with(:status).returns("# On branch master
0
+nothing to commit (working directory clean)
0
+")
0
+ assert Piston::Git::WorkingCopy.understands_dir?(@dir)
0
+ end
0
+
0
+ def test_denies_when_git_unavailable
0
+ Piston::Git::WorkingCopy.stubs(:git).raises(Piston::Git::Client::BadCommand)
0
+ deny Piston::Git::WorkingCopy.understands_dir?(@dir)
0
+ end
0
+end
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
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
0
@@ -0,0 +1,25 @@
0
+require File.dirname(__FILE__) + "/../../../test_helper"
0
+
0
+class TestGitWorkingCopyRememberance < Test::Unit::TestCase
0
+ def setup
0
+ @wcdir = Pathname.new("tmp/wc")
0
+ @wcdir.mkdir rescue nil
0
+ @wc = Piston::Git::WorkingCopy.new(@wcdir)
0
+ end
0
+
0
+ def teardown
0
+ @wcdir.rmtree
0
+ end
0
+
0
+ def test_creates_dot_piston_dot_yml_file
0
+ @wc.remember({}, "a" => "b")
0
+ assert((@wcdir + ".piston.yml").exist?)
0
+ end
0
+
0
+ def test_writes_values_as_yaml_under_handler_key
0
+ expected = {"a" => "b"}
0
+ @wc.remember({}, expected)
0
+ actual = YAML.load((@wcdir + ".piston.yml").read)
0