summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorash <smashwilson@gmail.com>2013-05-18 18:26:31 +0000
committerash <smashwilson@gmail.com>2013-05-18 18:26:31 +0000
commit8454d8dc3ae3a5807a95dfd66adefd22d23394f0 (patch)
treeb3c311366cbde248e7cb2735da57a0cf20088775
parentde4349c1d2209df2a38a781c867c1f0531878987 (diff)
downloadgitlab-shell-8454d8dc3ae3a5807a95dfd66adefd22d23394f0.tar.gz
Specs for logging during failure cases of fork-project.
-rw-r--r--spec/gitlab_projects_spec.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index 3977677..0d9fc72 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -131,7 +131,15 @@ describe GitlabProjects do
gl_projects_import.exec
end
+ it "should not fork without a destination namespace" do
+ missing_arg = build_gitlab_projects('fork-project', source_repo_name)
+ $logger.should_receive(:error).with("fork-project failed: no destination namespace provided.")
+ missing_arg.exec.should be_false
+ end
+
it "should not fork into a namespace that doesn't exist" do
+ message = "fork-project failed: destination namespace <#{tmp_repos_path}/forked-to-namespace> does not exist."
+ $logger.should_receive(:error).with(message)
gl_projects_fork.exec.should be_false
end
@@ -145,7 +153,13 @@ describe GitlabProjects do
end
it "should not fork if a project of the same name already exists" do
- #trying to fork again should fail as the repo already exists
+ # create a fake project at the intended destination
+ FileUtils.mkdir_p(File.join(tmp_repos_path, 'forked-to-namespace', repo_name))
+
+ # trying to fork again should fail as the repo already exists
+ message = "fork-project failed: destination repository <#{tmp_repos_path}/forked-to-namespace/#{repo_name}> "
+ message << "already exists."
+ $logger.should_receive(:error).with(message)
gl_projects_fork.exec.should be_false
end