summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorash <smashwilson@gmail.com>2013-05-18 18:12:30 +0000
committerash <smashwilson@gmail.com>2013-05-18 18:12:30 +0000
commit06e6e879ec1b7a71e0a11e231602d0fad467ba37 (patch)
treec05677f72d3f66f2f4e803b686671102fc9bb674
parent15bec2054f8aa66ad0f71748a735c7cb4a199076 (diff)
downloadgitlab-shell-06e6e879ec1b7a71e0a11e231602d0fad467ba37.tar.gz
Specifications for the 'bad paths' in mv-projects, and logging.
-rw-r--r--spec/gitlab_projects_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index 53694f5..3977677 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -60,6 +60,26 @@ describe GitlabProjects do
File.exists?(new_repo_path).should be_true
end
+ it "should fail if no destination path is provided" do
+ incomplete = build_gitlab_projects('mv-project', repo_name)
+ $logger.should_receive(:error).with("mv-project failed: no destination path provided.")
+ incomplete.exec.should be_false
+ end
+
+ it "should fail if the source path doesn't exist" do
+ bad_source = build_gitlab_projects('mv-project', 'bad-src.git', 'dest.git')
+ $logger.should_receive(:error).with("mv-project failed: source path <#{tmp_repos_path}/bad-src.git> does not exist.")
+ bad_source.exec.should be_false
+ end
+
+ it "should fail if the destination path already exists" do
+ FileUtils.mkdir_p(File.join(tmp_repos_path, 'already-exists.git'))
+ bad_dest = build_gitlab_projects('mv-project', repo_name, 'already-exists.git')
+ message = "mv-project failed: destination path <#{tmp_repos_path}/already-exists.git> already exists."
+ $logger.should_receive(:error).with(message)
+ bad_dest.exec.should be_false
+ end
+
it "should log an mv-project event" do
message = "Moving project #{repo_name} from <#{tmp_repo_path}> to <#{new_repo_path}>."
$logger.should_receive(:info).with(message)