summaryrefslogtreecommitdiff
path: root/spec/gitlab_projects_spec.rb
diff options
context:
space:
mode:
authorAngus MacArthur <amacarthur@blackberry.com>2013-04-16 11:56:39 -0400
committerAngus MacArthur <amacarthur@blackberry.com>2013-04-16 12:12:40 -0400
commit047dcb86af85a4f1a56cf34baff036af1aa3c222 (patch)
tree9506a2962af8df423aab4492af436fa5dd7d2c6c /spec/gitlab_projects_spec.rb
parent934aacb34ba65cd47ce8fefd4cad64c4a3951856 (diff)
downloadgitlab-shell-047dcb86af85a4f1a56cf34baff036af1aa3c222.tar.gz
additional fork check and enhanced tests
Diffstat (limited to 'spec/gitlab_projects_spec.rb')
-rw-r--r--spec/gitlab_projects_spec.rb23
1 files changed, 17 insertions, 6 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index f9d63b0..5c93f7c 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -79,19 +79,30 @@ describe GitlabProjects do
describe :fork_project do
let(:gl_project_import) { build_gitlab_projects('import-project', repo_name, 'https://github.com/randx/six.git') }
- let(:gl_projects) { build_gitlab_projects('fork-project', repo_name, 'forked-to-namespace')}
+ let(:gl_projects_fork) { build_gitlab_projects('fork-project', repo_name, 'forked-to-namespace')}
+ let(:dest_repo) { File.join(tmp_repos_path, 'forked-to-namespace', repo_name) }
before do
FileUtils.mkdir_p(tmp_repo_path)
- FileUtils.mkdir_p(File.join(tmp_repos_path, 'forked-to-namespace'))
gl_project_import.exec
end
+ it "should not fork into a namespace that doesn't exist" do
+ gl_projects_fork.exec.should be_false
+ end
+
it "should fork the repo" do
- gl_projects.exec
- File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name)).should be_true
- File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/update')).should be_true
- File.exists?(File.join(tmp_repos_path, 'forked-to-namespace', repo_name, '/hooks/post-receive')).should be_true
+ # create destination namespace
+ FileUtils.mkdir_p(File.join(tmp_repos_path, 'forked-to-namespace'))
+ gl_projects_fork.exec.should be_true
+ File.exists?(dest_repo).should be_true
+ File.exists?(File.join(dest_repo, '/hooks/update')).should be_true
+ File.exists?(File.join(dest_repo, '/hooks/post-receive')).should be_true
+ 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
+ gl_projects_fork.exec.should be_false
end
end