francois-piston 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. data/History.txt +19 -0
  2. data/License.txt +20 -0
  3. data/Manifest.txt +109 -0
  4. data/README.txt +136 -0
  5. data/VERSION.yml +4 -0
  6. data/bin/piston +5 -0
  7. data/lib/piston.rb +18 -0
  8. data/lib/piston/cli.rb +391 -0
  9. data/lib/piston/commands.rb +4 -0
  10. data/lib/piston/commands/base.rb +44 -0
  11. data/lib/piston/commands/convert.rb +26 -0
  12. data/lib/piston/commands/diff.rb +12 -0
  13. data/lib/piston/commands/import.rb +43 -0
  14. data/lib/piston/commands/info.rb +14 -0
  15. data/lib/piston/commands/lock_unlock.rb +21 -0
  16. data/lib/piston/commands/status.rb +40 -0
  17. data/lib/piston/commands/update.rb +34 -0
  18. data/lib/piston/commands/upgrade.rb +20 -0
  19. data/lib/piston/git.rb +13 -0
  20. data/lib/piston/git/client.rb +76 -0
  21. data/lib/piston/git/commit.rb +114 -0
  22. data/lib/piston/git/repository.rb +63 -0
  23. data/lib/piston/git/working_copy.rb +142 -0
  24. data/lib/piston/repository.rb +61 -0
  25. data/lib/piston/revision.rb +83 -0
  26. data/lib/piston/svn.rb +15 -0
  27. data/lib/piston/svn/client.rb +88 -0
  28. data/lib/piston/svn/repository.rb +67 -0
  29. data/lib/piston/svn/revision.rb +112 -0
  30. data/lib/piston/svn/working_copy.rb +182 -0
  31. data/lib/piston/version.rb +9 -0
  32. data/lib/piston/working_copy.rb +334 -0
  33. data/lib/subclass_responsibility_error.rb +2 -0
  34. data/test/integration_helpers.rb +35 -0
  35. data/test/spec_suite.rb +4 -0
  36. data/test/test_helper.rb +83 -0
  37. data/test/unit/git/commit/test_checkout.rb +31 -0
  38. data/test/unit/git/commit/test_each.rb +30 -0
  39. data/test/unit/git/commit/test_rememberance.rb +22 -0
  40. data/test/unit/git/commit/test_validation.rb +34 -0
  41. data/test/unit/git/repository/test_at.rb +23 -0
  42. data/test/unit/git/repository/test_basename.rb +12 -0
  43. data/test/unit/git/repository/test_branchanme.rb +15 -0
  44. data/test/unit/git/repository/test_guessing.rb +32 -0
  45. data/test/unit/git/working_copy/test_copying.rb +25 -0
  46. data/test/unit/git/working_copy/test_creation.rb +22 -0
  47. data/test/unit/git/working_copy/test_existence.rb +18 -0
  48. data/test/unit/git/working_copy/test_finalization.rb +15 -0
  49. data/test/unit/git/working_copy/test_guessing.rb +35 -0
  50. data/test/unit/git/working_copy/test_rememberance.rb +22 -0
  51. data/test/unit/svn/repository/test_at.rb +19 -0
  52. data/test/unit/svn/repository/test_basename.rb +24 -0
  53. data/test/unit/svn/repository/test_guessing.rb +45 -0
  54. data/test/unit/svn/revision/test_checkout.rb +28 -0
  55. data/test/unit/svn/revision/test_each.rb +22 -0
  56. data/test/unit/svn/revision/test_rememberance.rb +38 -0
  57. data/test/unit/svn/revision/test_validation.rb +50 -0
  58. data/test/unit/svn/working_copy/test_copying.rb +26 -0
  59. data/test/unit/svn/working_copy/test_creation.rb +16 -0
  60. data/test/unit/svn/working_copy/test_existence.rb +23 -0
  61. data/test/unit/svn/working_copy/test_externals.rb +56 -0
  62. data/test/unit/svn/working_copy/test_finalization.rb +17 -0
  63. data/test/unit/svn/working_copy/test_guessing.rb +18 -0
  64. data/test/unit/svn/working_copy/test_rememberance.rb +26 -0
  65. data/test/unit/test_info.rb +37 -0
  66. data/test/unit/test_lock_unlock.rb +47 -0
  67. data/test/unit/test_repository.rb +51 -0
  68. data/test/unit/test_revision.rb +31 -0
  69. data/test/unit/working_copy/test_guessing.rb +35 -0
  70. data/test/unit/working_copy/test_info.rb +14 -0
  71. data/test/unit/working_copy/test_rememberance.rb +42 -0
  72. data/test/unit/working_copy/test_validate.rb +63 -0
  73. metadata +178 -0
@@ -0,0 +1,22 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Git::TestGitWorkingCopyRememberance < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = mkpath("tmp/wc")
7
+ Dir.chdir(@wcdir) { git(:init) }
8
+ @wc = Piston::Git::WorkingCopy.new(@wcdir)
9
+ end
10
+
11
+ def test_creates_dot_piston_dot_yml_file
12
+ @wc.remember({}, "a" => "b")
13
+ assert((@wcdir + ".piston.yml").exist?)
14
+ end
15
+
16
+ def test_writes_values_as_yaml_under_handler_key
17
+ expected = {"a" => "b"}
18
+ @wc.remember({}, expected)
19
+ actual = YAML.load((@wcdir + ".piston.yml").read)
20
+ assert_equal expected, actual["handler"]
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnRepositoryAt < Piston::TestCase
4
+ def setup
5
+ super
6
+ @repos = Piston::Svn::Repository.new("http://bla.com/svn/repos/trunk")
7
+ end
8
+
9
+ def test_instantiate_revision_at_head
10
+ Piston::Svn::Revision.expects(:new).with(@repos, "HEAD").returns(:newrev)
11
+ assert_equal :newrev, @repos.at(:head)
12
+ end
13
+
14
+ def test_instantiate_revision_using_recalled_values
15
+ recalled_values = {Piston::Svn::REMOTE_REV => 9123, Piston::Svn::UUID => "5ecf4fe2-1ee6-0310-87b1-e25e094e27de"}
16
+ Piston::Svn::Revision.expects(:new).with(@repos, 9123, recalled_values).returns(:newrev)
17
+ assert_equal :newrev, @repos.at(recalled_values)
18
+ end
19
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnRepositoryBasename < Piston::TestCase
4
+ def test_basename_is_urls_path_last_component
5
+ assert_equal "piston", basename("http://svn.rubyforge.org/var/svn/piston")
6
+ end
7
+
8
+ def test_basename_is_urls_path_last_component_minus_trunk
9
+ assert_equal "attachment_fu", basename("svn+ssh://some.host.com/svn/attachment_fu/trunk")
10
+ end
11
+
12
+ def test_basename_is_urls_path_last_component_before_branches
13
+ assert_equal "rails", basename("svn://some.host.com/svn/rails/branches/stable")
14
+ end
15
+
16
+ def test_basename_is_urls_path_last_component_before_tags
17
+ assert_equal "plugin", basename("https://some.host.com/svn/plugin/tags/stable")
18
+ end
19
+
20
+ private
21
+ def basename(url)
22
+ Piston::Svn::Repository.new(url).basename
23
+ end
24
+ end
@@ -0,0 +1,45 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnRepositoryGuessing < Piston::TestCase
4
+ def test_guesses_with_svn_protocol
5
+ assert Piston::Svn::Repository.understands_url?("svn://a.host.com/")
6
+ end
7
+
8
+ def test_guesses_with_svn_plus_bla_protocol
9
+ assert Piston::Svn::Repository.understands_url?("svn+bla://username@a.host.com/")
10
+ end
11
+
12
+ def test_guesses_with_svn_plus_ssh_protocol
13
+ assert Piston::Svn::Repository.understands_url?("svn+ssh://username@a.host.com/")
14
+ end
15
+
16
+ def test_contacts_repository_for_file_protocol
17
+ url = "file:///home/username/svn/projects/trunk"
18
+ Piston::Svn::Repository.expects(:svn).with(:info, url).returns("Repository UUID: abcdef\n")
19
+ assert Piston::Svn::Repository.understands_url?(url)
20
+ end
21
+
22
+ def test_contacts_repository_for_http_protocol
23
+ url = "http://svn.collab.net/repos/svn/trunk"
24
+ Piston::Svn::Repository.expects(:svn).with(:info, url).returns("Repository UUID: abcdef\n")
25
+ assert Piston::Svn::Repository.understands_url?(url)
26
+ end
27
+
28
+ def test_contacts_repository_for_https_protocol
29
+ url = "https://svn.collab.net/repos/svn/trunk"
30
+ Piston::Svn::Repository.expects(:svn).with(:info, url).returns("Repository UUID: abcdef\n")
31
+ assert Piston::Svn::Repository.understands_url?(url)
32
+ end
33
+
34
+ def test_says_does_not_understand_when_svn_info_errors_out
35
+ url = "http://rubyonrails.org/"
36
+ Piston::Svn::Repository.expects(:svn).with(:info, url).raises(Piston::Svn::Client::Failed)
37
+ deny Piston::Svn::Repository.understands_url?(url)
38
+ end
39
+
40
+ def test_says_does_not_understand_when_svn_command_not_found
41
+ url = "http://rubyonrails.org/"
42
+ Piston::Svn::Repository.expects(:svn).with(:info, url).raises(Piston::Svn::Client::BadCommand)
43
+ deny Piston::Svn::Repository.understands_url?(url)
44
+ end
45
+ end
@@ -0,0 +1,28 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnRevisionCheckout < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = Pathname.new("tmp/wc")
7
+ @repos = mock("repository")
8
+ @repos.stubs(:url).returns("http://a.repos.com/trunk")
9
+ end
10
+
11
+ def test_head_checkout_to_path
12
+ rev = new_revision("HEAD")
13
+ rev.expects(:svn).with(:checkout, "--revision", "HEAD", @repos.url, @wcdir).returns("Checked out revision 1322.")
14
+ rev.checkout_to(@wcdir)
15
+ assert_equal 1322, rev.revision
16
+ end
17
+
18
+ def test_specific_revision_checkout_to_path
19
+ rev = new_revision(1231)
20
+ rev.expects(:svn).with(:checkout, "--revision", 1231, @repos.url, @wcdir).returns("Checked out revision 1231.")
21
+ rev.checkout_to(@wcdir)
22
+ end
23
+
24
+ private
25
+ def new_revision(revision)
26
+ Piston::Svn::Revision.new(@repos, revision)
27
+ end
28
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnRevisionEach < Piston::TestCase
4
+ def setup
5
+ super
6
+ @repos = mock("repository")
7
+ @repos.stubs(:url).returns("http://a.repos.com/project/trunk")
8
+
9
+ @wcdir = Pathname.new("tmp/.wc.tmp")
10
+
11
+ @rev = Piston::Svn::Revision.new(@repos, "HEAD")
12
+ @rev.stubs(:svn).returns("Checked out revision 111.\n")
13
+ @rev.checkout_to(@wcdir)
14
+ end
15
+
16
+ def test_each_skips_over_svn_metadata_folders
17
+ @rev.expects(:svn).with(:ls, "--recursive", @wcdir).returns("CONTRIBUTORS\nREADME\ntest/test_helper.rb\n")
18
+ expected = ["CONTRIBUTORS", "README", "test/test_helper.rb"]
19
+ actual = @rev.inject([]) {|memo, relpath| memo << relpath}
20
+ assert_equal expected.sort, actual.sort
21
+ end
22
+ end
@@ -0,0 +1,38 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnRevisionRememberance < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = mkpath("tmp/wc")
7
+ @repos = mock("repository")
8
+ @repos.stubs(:url).returns("http://a.repos.com/svn/trunk")
9
+
10
+ @info = {"Path" => @wcdir.realpath,
11
+ "URL" => "http://a.repos.com/svn/trunk",
12
+ "Repository Root" => "http://a.repos.com/svn",
13
+ "Repository UUID" => "some-long-uuid",
14
+ "Revision" => "9283",
15
+ "Node Kind" => "directory",
16
+ "Schedule" => "normal",
17
+ "Last Changed Author" => "me",
18
+ "Last Changed Rev" => "9283",
19
+ "Last Changed Date" => "2008-03-11 20:44:24 -0400 (Tue, 11 Mar 2008)"}
20
+ end
21
+
22
+ def test_remembers_repos_uuid
23
+ rev = new_revision("HEAD")
24
+ rev.expects(:svn).with(:info, "--revision", "HEAD", @repos.url).returns(@info.to_yaml)
25
+ assert_equal "some-long-uuid", rev.remember_values[Piston::Svn::UUID]
26
+ end
27
+
28
+ def test_remembers_repos_revision
29
+ rev = new_revision("HEAD")
30
+ rev.expects(:svn).with(:info, "--revision", "HEAD", @repos.url).returns(@info.to_yaml)
31
+ assert_equal "9283", rev.remember_values[Piston::Svn::REMOTE_REV]
32
+ end
33
+
34
+ private
35
+ def new_revision(revision)
36
+ Piston::Svn::Revision.new(@repos, revision)
37
+ end
38
+ end
@@ -0,0 +1,50 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnRevisionValidation < Piston::TestCase
4
+ def setup
5
+ super
6
+ @repository = mock("repository")
7
+ @repository.stubs(:url).returns("svn://svn.my-repos.com/projects/libcalc/trunk")
8
+ end
9
+
10
+ def test_revision_is_invalid_unless_same_uuid
11
+ rev = new_revision("HEAD", Piston::Svn::UUID => "1234")
12
+ rev.expects(:svn).with(:info, "--revision", "HEAD", @repository.url).returns(INFO)
13
+ assert_raise Piston::Svn::Revision::UuidChanged do
14
+ rev.validate!
15
+ end
16
+ end
17
+
18
+ def test_revision_is_invalid_if_repository_location_does_not_exist_anymore
19
+ rev = new_revision("HEAD", Piston::Svn::UUID => "038cbeb6-2227-0410-91ec-8f9533625906")
20
+ rev.expects(:svn).with(:info, "--revision", "HEAD", @repository.url).returns("#{@repository.url}: (Not a valid URL)")
21
+ assert_raise Piston::Svn::Revision::RepositoryMoved do
22
+ rev.validate!
23
+ end
24
+ end
25
+
26
+ def test_revision_is_valid_if_repository_is_present_and_same_uuid
27
+ rev = new_revision("HEAD", Piston::Svn::UUID => "038cbeb6-2227-0410-91ec-8f9533625906")
28
+ rev.expects(:svn).with(:info, "--revision", "HEAD", @repository.url).returns(INFO)
29
+ assert_nothing_raised do
30
+ rev.validate!
31
+ end
32
+ end
33
+
34
+ protected
35
+ def new_revision(rev, recalled_values={})
36
+ Piston::Svn::Revision.new(@repository, rev, recalled_values)
37
+ end
38
+
39
+ INFO = <<EOF
40
+ Path: project
41
+ URL: svn://svn.my-repos.com/projects/libcalc/trunk
42
+ Repository Root: svn://svn.my-repos.com/projects
43
+ Repository UUID: 038cbeb6-2227-0410-91ec-8f9533625906
44
+ Revision: 1234
45
+ Node Kind: directory
46
+ Last Changed Author: francois
47
+ Last Changed Rev: 1232
48
+ Last Changed Date: 2008-04-06 21:57:10 -0400 (Sun, 06 Apr 2008)
49
+ EOF
50
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnWorkingCopyCopying < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = mkpath("tmp/wc")
7
+ @wc = Piston::Svn::WorkingCopy.new(@wcdir)
8
+ @wc.stubs(:svn)
9
+ @wc.stubs(:svn).with(:info, anything).returns("a:b")
10
+ end
11
+
12
+ def test_copies_files
13
+ files = ["file.rb"]
14
+ files.expects(:copy_to).with("file.rb", @wcdir + files.first)
15
+ @wc.copy_from(files)
16
+ end
17
+
18
+ def test_ensures_directories_are_created
19
+ files = ["file/a.rb"]
20
+ @wcdir.expects(:+).with(files.first).returns(target = mock("target"))
21
+ target.expects(:dirname).returns(target)
22
+ target.expects(:mkdir)
23
+ files.expects(:copy_to).with("file/a.rb", target)
24
+ @wc.copy_from(files)
25
+ end
26
+ end
@@ -0,0 +1,16 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnWorkingCopyCreation < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = mkpath("tmp/wc")
7
+ @wc = Piston::Svn::WorkingCopy.new(@wcdir)
8
+ @wc.stubs(:svn)
9
+ @wc.stubs(:svn).with(:info, anything).returns("a:b")
10
+ end
11
+
12
+ def test_create_uses_svn_mkdir
13
+ @wc.expects(:svn).with(:mkdir, @wcdir)
14
+ @wc.create
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnWorkingCopyExistence < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = Pathname.new(File.expand_path("tmp/wc"))
7
+ @wc = Piston::Svn::WorkingCopy.new(@wcdir)
8
+ end
9
+
10
+ def test_exist_false_when_dir_not_present
11
+ deny @wc.exist?
12
+ end
13
+
14
+ def test_exist_false_when_dir_present_but_not_an_svn_wc
15
+ @wcdir.mkpath
16
+ deny @wc.exist?
17
+ end
18
+
19
+ def test_exist_true_when_svn_working_copy_at_path
20
+ @wc.expects(:svn).with(:info, @wcdir).returns("Path: b")
21
+ assert @wc.exist?
22
+ end
23
+ end
@@ -0,0 +1,56 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestWorkingCopyExternals < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = mkpath("tmp/wc")
7
+ @wc = Piston::Svn::WorkingCopy.new(@wcdir)
8
+ end
9
+
10
+ def test_parse_empty_svn_externals
11
+ @wc.stubs(:svn).returns(EMPTY_EXTERNALS)
12
+ assert_equal({}, @wc.externals)
13
+ end
14
+
15
+ def test_parse_simple_externals
16
+ @wc.stubs(:svn).returns(SIMPLE_RAILS_EXTERNALS)
17
+ assert_equal({@wcdir + "vendor/rails" => {:revision => :head, :url => "http://dev.rubyonrails.org/svn/rails/trunk"}}, @wc.externals)
18
+ end
19
+
20
+ def test_parse_externals_with_revision
21
+ @wc.stubs(:svn).returns(VERSIONED_RAILS_EXTERNALS)
22
+ assert_equal({@wcdir + "vendor/rails" => {:revision => 8726, :url => "http://dev.rubyonrails.org/svn/rails/trunk"}}, @wc.externals)
23
+ end
24
+
25
+ def test_parse_externals_with_long_revision
26
+ @wc.stubs(:svn).returns(LONG_VERSION_RAILS_EXTERNALS)
27
+ assert_equal({@wcdir + "vendor/rails" => {:revision => 8726, :url => "http://dev.rubyonrails.org/svn/rails/trunk"}}, @wc.externals)
28
+ end
29
+
30
+ def test_remove_external_references_calls_svn_propdel
31
+ @wc.expects(:svn).with(:propdel, "svn:externals", @wcdir+"vendor")
32
+ @wc.remove_external_references(@wcdir+"vendor")
33
+ end
34
+
35
+ def test_remove_external_references_calls_svn_propdel_with_multiple_dirs
36
+ @wc.expects(:svn).with(:propdel, "svn:externals", @wcdir+"vendor", @wcdir+"vendor/plugins")
37
+ @wc.remove_external_references(@wcdir+"vendor", @wcdir+"vendor/plugins")
38
+ end
39
+
40
+ EMPTY_EXTERNALS = ""
41
+ SIMPLE_RAILS_EXTERNALS = <<EOF
42
+ Properties on 'vendor':
43
+ svn:externals : rails http://dev.rubyonrails.org/svn/rails/trunk
44
+
45
+ EOF
46
+ VERSIONED_RAILS_EXTERNALS = <<EOF
47
+ Properties on 'vendor':
48
+ svn:externals : rails -r8726 http://dev.rubyonrails.org/svn/rails/trunk
49
+
50
+ EOF
51
+ LONG_VERSION_RAILS_EXTERNALS = <<EOF
52
+ Properties on 'vendor':
53
+ svn:externals : rails --revision 8726 http://dev.rubyonrails.org/svn/rails/trunk
54
+
55
+ EOF
56
+ end
@@ -0,0 +1,17 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnWorkingCopyFinalization < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = mkpath("tmp/wc")
7
+ @wc = Piston::Svn::WorkingCopy.new(@wcdir)
8
+ end
9
+
10
+ def test_finalize_adds_all_top_level_entries_to_working_copy
11
+ File.open(@wcdir + "a.rb", "wb") {|f| f.write "Hello World!"}
12
+ File.open(@wcdir + "b.rb", "wb") {|f| f.write "Hello World!"}
13
+ @wc.expects(:svn).with(:add, (@wcdir + "a.rb").to_s)
14
+ @wc.expects(:svn).with(:add, (@wcdir + "b.rb").to_s)
15
+ @wc.finalize
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnWorkingCopyGuessing < Piston::TestCase
4
+ def setup
5
+ super
6
+ @dir = mkpath("tmp/wc")
7
+ end
8
+
9
+ def test_does_svn_info_on_directory
10
+ Piston::Svn::WorkingCopy.expects(:svn).with(:info, @dir).returns("Path: xxx\n")
11
+ assert Piston::Svn::WorkingCopy.understands_dir?(@dir)
12
+ end
13
+
14
+ def test_denies_when_svn_not_available
15
+ Piston::Svn::WorkingCopy.expects(:svn).with(:info, @dir).raises(Piston::Svn::Client::BadCommand)
16
+ deny Piston::Svn::WorkingCopy.understands_dir?(@dir)
17
+ end
18
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/../../../test_helper")
2
+
3
+ class Piston::Svn::TestSvnWorkingCopyRememberance < Piston::TestCase
4
+ def setup
5
+ super
6
+ @wcdir = mkpath("tmp/wc")
7
+ @wc = Piston::Svn::WorkingCopy.new(@wcdir)
8
+ @wc.stubs(:svn)
9
+ @wc.stubs(:svn).with(:info, anything).returns("a:b")
10
+ end
11
+
12
+ def teardown
13
+ @wcdir.rmtree rescue nil
14
+ end
15
+
16
+ def test_after_remember_adds_path_using_svn
17
+ @wc.expects(:svn).with(:info, :the_path).returns("a: (Not a versioned resource)\n")
18
+ @wc.expects(:svn).with(:add, :the_path)
19
+ @wc.after_remember(:the_path)
20
+ end
21
+
22
+ def test_after_remember_does_not_add_if_file_already_under_version_control
23
+ @wc.expects(:svn).with(:info, :the_path).returns("a: b\n")
24
+ @wc.after_remember(:the_path)
25
+ end
26
+ end