summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 10:42:01 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-02-05 10:42:01 +0200
commit23c76715a8a3fcf2fca20891d709c63ba4131fa5 (patch)
tree7abfe9881e932e36a5c268d0e286a4b126dff55e /spec
parentc902d83b45ac981d186540dfea80a887882501cf (diff)
downloadgitlab-shell-23c76715a8a3fcf2fca20891d709c63ba4131fa5.tar.gz
let test adding repo for real
Diffstat (limited to 'spec')
-rw-r--r--spec/gitlab_projects_spec.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/gitlab_projects_spec.rb b/spec/gitlab_projects_spec.rb
index 95e4b92..4722a35 100644
--- a/spec/gitlab_projects_spec.rb
+++ b/spec/gitlab_projects_spec.rb
@@ -17,10 +17,21 @@ describe GitlabProjects do
before do
argv('add-project', 'gitlab-ci.git')
@gl_projects = GitlabProjects.new
+ @gl_projects.stub(full_path: tmp_repo_path)
+ end
+
+ after do
+ FileUtils.rm_rf(tmp_repo_path)
+ end
+
+ it "should create a directory" do
+ @gl_projects.stub(system: true)
+ @gl_projects.send :add_project
+ File.exists?(tmp_repo_path).should be_true
end
it "should receive valid cmd" do
- valid_cmd = "cd /home/git/repositories/gitlab-ci.git && git init --bare && ln -s /home/git/gitlab-shell/hooks/post-receive /home/git/repositories/gitlab-ci.git/hooks/post-receive"
+ valid_cmd = "cd #{tmp_repo_path} && git init --bare && ln -s /home/git/gitlab-shell/hooks/post-receive #{tmp_repo_path}/hooks/post-receive"
@gl_projects.should_receive(:system).with(valid_cmd)
@gl_projects.send :add_project
end
@@ -31,4 +42,8 @@ describe GitlabProjects do
ARGV[i] = arg
end
end
+
+ def tmp_repo_path
+ File.join(ROOT_PATH, 'tmp', 'gitlab-ci.git')
+ end
end